Make tests self-hosting * Add wptserve as a submodule for serving HTTP files * Add pywebsocket as a submodule for websockets * Add a serve.py script that initalises the test environment with the servers running on free ports * Remove all PHP from the repository and replace it with wptserve-compatible python * Remove all .htaccess files from the repository and replace with .headers files * Some additional fixes to tests that were otherwise broken
diff --git a/XMLHttpRequest/abort-after-timeout.htm b/XMLHttpRequest/abort-after-timeout.htm index b59c51d..cdc38c4 100644 --- a/XMLHttpRequest/abort-after-timeout.htm +++ b/XMLHttpRequest/abort-after-timeout.htm
@@ -14,7 +14,7 @@ test.step(function() { // timeout is 100ms - // the download would otherwise take 500ms + // the download would otherwise take 1000ms // we check after 300ms to make sure abort does not fire an "abort" event var timeoutFired = false; @@ -50,7 +50,7 @@ assert_unreached("abort() should not cause the abort event to fire"); }); - client.open("GET", "resources/delay.php?ms=500000", true); + client.open("GET", "/common/blank.html?pipe=trickle(d1)", true); client.send(null); }); </script> diff --git a/XMLHttpRequest/abort-during-upload.htm b/XMLHttpRequest/abort-during-upload.htm index ba29644..93c8a2f 100644 --- a/XMLHttpRequest/abort-during-upload.htm +++ b/XMLHttpRequest/abort-during-upload.htm
@@ -20,7 +20,7 @@ } test.step(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/delay.php?ms=1000") + client.open("POST", "resources/delay.py?ms=1000") client.addEventListener('progress', logEvt) client.addEventListener('abort', logEvt) client.addEventListener('loadend', function (e) { diff --git a/XMLHttpRequest/abort-event-abort.htm b/XMLHttpRequest/abort-event-abort.htm index e840ecb..803019f 100644 --- a/XMLHttpRequest/abort-event-abort.htm +++ b/XMLHttpRequest/abort-event-abort.htm
@@ -35,10 +35,10 @@ }); }; - xhr.open("GET", "./resources/content.php", true); // This should cause a readystatechange event that calls abort() + xhr.open("GET", "./resources/content.py", true); // This should cause a readystatechange event that calls abort() assert_throws("InvalidStateError", function(){ xhr.send() }) test.done() }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/abort-event-loadend.htm b/XMLHttpRequest/abort-event-loadend.htm index 7a92d07..e1e2030 100644 --- a/XMLHttpRequest/abort-event-loadend.htm +++ b/XMLHttpRequest/abort-event-loadend.htm
@@ -10,9 +10,7 @@ <div id="log"></div> <script type="text/javascript"> - var test = async_test(); - - test.step(function() + var test = async_test(function(test) { var xhr = new XMLHttpRequest(); @@ -37,9 +35,9 @@ }); }; - xhr.open("GET", "./resources/content.php", true); + xhr.open("GET", "resources/content.py", true); xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/abort-event-order.htm b/XMLHttpRequest/abort-event-order.htm index a2d6f69..4122f77 100644 --- a/XMLHttpRequest/abort-event-order.htm +++ b/XMLHttpRequest/abort-event-order.htm
@@ -50,9 +50,9 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/abort-upload-event-abort.htm b/XMLHttpRequest/abort-upload-event-abort.htm index 97383ad..3c063a3 100644 --- a/XMLHttpRequest/abort-upload-event-abort.htm +++ b/XMLHttpRequest/abort-upload-event-abort.htm
@@ -38,9 +38,9 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/abort-upload-event-loadend.htm b/XMLHttpRequest/abort-upload-event-loadend.htm index 22a42a5..e6a3237 100644 --- a/XMLHttpRequest/abort-upload-event-loadend.htm +++ b/XMLHttpRequest/abort-upload-event-loadend.htm
@@ -38,9 +38,9 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/event-progress.htm b/XMLHttpRequest/event-progress.htm index 0c254f9..6f3dc12 100644 --- a/XMLHttpRequest/event-progress.htm +++ b/XMLHttpRequest/event-progress.htm
@@ -23,7 +23,7 @@ if (client.readyState === 4) assert_unreached("onprogress not called."); }); - client.open("GET", "resources/trickle.php"); + client.open("GET", "resources/trickle.py"); client.send(null); }); </script> diff --git a/XMLHttpRequest/event-readystatechange-loaded.htm b/XMLHttpRequest/event-readystatechange-loaded.htm index 50f411d..dc22e1a 100644 --- a/XMLHttpRequest/event-readystatechange-loaded.htm +++ b/XMLHttpRequest/event-readystatechange-loaded.htm
@@ -32,7 +32,7 @@ } }); - client.open("GET", "resources/trickle.php?count=1000"); + client.open("GET", "resources/trickle.py?count=1000"); client.send(null); }); </script> diff --git a/XMLHttpRequest/event-timeout.htm b/XMLHttpRequest/event-timeout.htm index f58fd56..d165e52 100644 --- a/XMLHttpRequest/event-timeout.htm +++ b/XMLHttpRequest/event-timeout.htm
@@ -1,34 +1,34 @@ -<!doctype html> -<html> - <head> - <title>XMLHttpRequest: timeout event</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#handler-xhr-ontimeout" data-tested-assertations="../.." /> - <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#event-xhr-timeout" data-tested-assertations="../.." /> - <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-timeout-attribute" data-tested-assertations="following-sibling::ol/li[2]" /> - <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#timeout-error" data-tested-assertations=".." /> - <link rel="help" href="http://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd" /> - </head> - <body> - <div id="log"></div> - <script> - var test = async_test(); - test.step(function() { - var client = new XMLHttpRequest(); - client.ontimeout = function() { - test.step(function() { - assert_equals(client.readyState, 4); - test.done(); - }); - }; - client.timeout = 5; - client.open("GET", "resources/delay.php?ms=1000000"); - client.send(null); - setTimeout(test.step_func(function () { - assert_unreached("ontimeout not called."); - }), 10); - }); - </script> - </body> -</html> +<!doctype html> +<html> + <head> + <title>XMLHttpRequest: timeout event</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#handler-xhr-ontimeout" data-tested-assertations="../.." /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#event-xhr-timeout" data-tested-assertations="../.." /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-timeout-attribute" data-tested-assertations="following-sibling::ol/li[2]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#timeout-error" data-tested-assertations=".." /> + <link rel="help" href="http://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd" /> + </head> + <body> + <div id="log"></div> + <script> + var test = async_test(); + test.step(function() { + var client = new XMLHttpRequest(); + client.ontimeout = function() { + test.step(function() { + assert_equals(client.readyState, 4); + test.done(); + }); + }; + client.timeout = 5; + client.open("GET", "resources/delay.py?ms=20000"); + client.send(null); + setTimeout(test.step_func(function () { + assert_unreached("ontimeout not called."); + }), 10); + }); + </script> + </body> +</html> diff --git a/XMLHttpRequest/event-upload-progress.htm b/XMLHttpRequest/event-upload-progress.htm index 175dc7f..4a9dc12 100644 --- a/XMLHttpRequest/event-upload-progress.htm +++ b/XMLHttpRequest/event-upload-progress.htm
@@ -20,7 +20,7 @@ client.onreadystatechange = test.step_func(function() { if (client.readyState === 4) assert_unreached("onprogress not called."); }); - client.open("POST", "resources/upload.php"); + client.open("POST", "resources/upload.py"); client.send("This is a test string."); }); </script> diff --git a/XMLHttpRequest/formdata-blob.htm b/XMLHttpRequest/formdata-blob.htm index 6f33f25..633ac80 100644 --- a/XMLHttpRequest/formdata-blob.htm +++ b/XMLHttpRequest/formdata-blob.htm
@@ -20,7 +20,7 @@ assert_equals(client.responseText, expected); test.done(); }); - client.open("POST", "resources/upload.php"); + client.open("POST", "resources/upload.py"); client.send(fd); }); } diff --git a/XMLHttpRequest/formdata.htm b/XMLHttpRequest/formdata.htm index 31c70d4..e6c0aef 100644 --- a/XMLHttpRequest/formdata.htm +++ b/XMLHttpRequest/formdata.htm
@@ -22,7 +22,7 @@ assert_equals(client.responseText, expected); test.done(); }); - client.open("POST", "resources/upload.php"); + client.open("POST", "resources/upload.py"); client.send(fd); }); } diff --git a/XMLHttpRequest/getallresponseheaders-cookies.htm b/XMLHttpRequest/getallresponseheaders-cookies.htm index 5bed7d8..04979e0 100644 --- a/XMLHttpRequest/getallresponseheaders-cookies.htm +++ b/XMLHttpRequest/getallresponseheaders-cookies.htm
@@ -30,7 +30,7 @@ test.done() }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getallresponseheaders-status.htm b/XMLHttpRequest/getallresponseheaders-status.htm index ff68348..7a8148f 100644 --- a/XMLHttpRequest/getallresponseheaders-status.htm +++ b/XMLHttpRequest/getallresponseheaders-status.htm
@@ -26,7 +26,7 @@ test.done() }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-case-insensitive.htm b/XMLHttpRequest/getresponseheader-case-insensitive.htm index 0b16a4a..b6540c8 100644 --- a/XMLHttpRequest/getresponseheader-case-insensitive.htm +++ b/XMLHttpRequest/getresponseheader-case-insensitive.htm
@@ -26,7 +26,7 @@ } }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-chunked-trailer.htm b/XMLHttpRequest/getresponseheader-chunked-trailer.htm index de219e1..f2acfb0 100644 --- a/XMLHttpRequest/getresponseheader-chunked-trailer.htm +++ b/XMLHttpRequest/getresponseheader-chunked-trailer.htm
@@ -12,7 +12,7 @@ var test = async_test() test.step(function() { var client = new XMLHttpRequest() - client.onreadystatechange = function() { + client.onreadystatechange = function() { test.step(function() { if(client.readyState == 4) { assert_equals(client.getResponseHeader('Trailer'), 'X-Test-Me') @@ -24,7 +24,7 @@ } }) } - client.open("GET", "resources/chunked.php") + client.open("GET", "resources/chunked.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-cookies-and-more.htm b/XMLHttpRequest/getresponseheader-cookies-and-more.htm index e17ad0e..4f065cc 100644 --- a/XMLHttpRequest/getresponseheader-cookies-and-more.htm +++ b/XMLHttpRequest/getresponseheader-cookies-and-more.htm
@@ -28,7 +28,7 @@ test.done() }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-server-date.htm b/XMLHttpRequest/getresponseheader-server-date.htm index deca4a6..d157842 100644 --- a/XMLHttpRequest/getresponseheader-server-date.htm +++ b/XMLHttpRequest/getresponseheader-server-date.htm
@@ -21,7 +21,7 @@ } }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-special-characters.htm b/XMLHttpRequest/getresponseheader-special-characters.htm index ca4e262..5416e6a 100644 --- a/XMLHttpRequest/getresponseheader-special-characters.htm +++ b/XMLHttpRequest/getresponseheader-special-characters.htm
@@ -26,7 +26,7 @@ } }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") client.send(null) }) </script> diff --git a/XMLHttpRequest/getresponseheader-unsent-opened-state.htm b/XMLHttpRequest/getresponseheader-unsent-opened-state.htm index d19d4e7..d0f9d27 100644 --- a/XMLHttpRequest/getresponseheader-unsent-opened-state.htm +++ b/XMLHttpRequest/getresponseheader-unsent-opened-state.htm
@@ -22,7 +22,7 @@ } }) } - client.open("GET", "resources/headers.php") + client.open("GET", "resources/headers.py") assert_equals(client.getResponseHeader("x-custom-header"), null) assert_equals(client.getResponseHeader("Date"), null) client.send(null) diff --git a/XMLHttpRequest/open-after-setrequestheader.htm b/XMLHttpRequest/open-after-setrequestheader.htm index 5f9c509..1cfd796 100644 --- a/XMLHttpRequest/open-after-setrequestheader.htm +++ b/XMLHttpRequest/open-after-setrequestheader.htm
@@ -21,10 +21,10 @@ } }) } - client.open("GET", "resources/inspect-headers.php?filter_name=X-foo") + client.open("GET", "resources/inspect-headers.py?filter_name=X-foo") assert_equals(client.readyState, 1) client.setRequestHeader('X-foo', 'bar') - client.open("GET", "resources/inspect-headers.php?filter_name=X-foo") + client.open("GET", "resources/inspect-headers.py?filter_name=X-foo") assert_equals(client.readyState, 1) client.send() }) diff --git a/XMLHttpRequest/open-method-case-insensitive.htm b/XMLHttpRequest/open-method-case-insensitive.htm index 350541f..86552a2 100644 --- a/XMLHttpRequest/open-method-case-insensitive.htm +++ b/XMLHttpRequest/open-method-case-insensitive.htm
@@ -13,7 +13,7 @@ function method(method) { test(function() { var client = new XMLHttpRequest() - client.open(method, "resources/content.php", false) + client.open(method, "resources/content.py", false) client.send(null) assert_equals(client.getResponseHeader("x-request-method"), method.toUpperCase()) }, document.title + " (" + method.toUpperCase() + ")") diff --git a/XMLHttpRequest/open-method-case-sensitive.htm b/XMLHttpRequest/open-method-case-sensitive.htm index 4eb124b..767ad25 100644 --- a/XMLHttpRequest/open-method-case-sensitive.htm +++ b/XMLHttpRequest/open-method-case-sensitive.htm
@@ -12,7 +12,7 @@ function method(method) { test(function() { var client = new XMLHttpRequest() - client.open(method, "resources/content.php", false) + client.open(method, "resources/content.py", false) client.send(null) assert_equals(client.getResponseHeader("x-request-method"), method) }, document.title + " (" + method + ")") diff --git a/XMLHttpRequest/open-referer.htm b/XMLHttpRequest/open-referer.htm index 615d84a..3e2afb3 100644 --- a/XMLHttpRequest/open-referer.htm +++ b/XMLHttpRequest/open-referer.htm
@@ -4,14 +4,14 @@ <title>XMLHttpRequest: open() - value of Referer header</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="/following::ol[1]/li[2]/ol[1]/li[4]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="/following::ol[1]/li[2]/ol[1]/li[4]" /> </head> <body> <div id="log"></div> <script> test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/inspect-headers.php?filter_name=referer", false) + client.open("POST", "resources/inspect-headers.py?filter_name=referer", false) client.send(null) assert_equals(client.responseText, "referer: "+location.href+'\n') }) diff --git a/XMLHttpRequest/open-url-encoding.htm b/XMLHttpRequest/open-url-encoding.htm index cd02884..53022de 100644 --- a/XMLHttpRequest/open-url-encoding.htm +++ b/XMLHttpRequest/open-url-encoding.htm
@@ -12,7 +12,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/content.php?ß", false) + client.open("GET", "resources/content.py?ß", false) client.send(null) assert_equals(client.getResponseHeader("x-request-query"), "%C3%9F") }) diff --git a/XMLHttpRequest/open-url-fragment.htm b/XMLHttpRequest/open-url-fragment.htm index d5495be..2b39f5c 100644 --- a/XMLHttpRequest/open-url-fragment.htm +++ b/XMLHttpRequest/open-url-fragment.htm
@@ -17,21 +17,21 @@ }) test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/requri.php#foobar", false) + client.open("GET", "resources/requri.py#foobar", false) client.send(null) - assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php$/) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.py$/) }, 'make sure fragment is removed from URL before request') test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/requri.php?help=#foobar", false) + client.open("GET", "resources/requri.py?help=#foobar", false) client.send(null) - assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php\?help=$/) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.py\?help=$/) }, 'make sure fragment is removed from URL before request (with query string)') test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/requri.php?" +encodeURIComponent("#foobar"), false) + client.open("GET", "resources/requri.py?" +encodeURIComponent("#foobar"), false) client.send(null) - assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php\?%23foobar$/) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.py\?%23foobar$/) }, 'make sure escaped # is not removed') </script> </body> diff --git a/XMLHttpRequest/open-url-worker-origin.htm b/XMLHttpRequest/open-url-worker-origin.htm index 33448f8..5f1807f 100644 --- a/XMLHttpRequest/open-url-worker-origin.htm +++ b/XMLHttpRequest/open-url-worker-origin.htm
@@ -15,7 +15,7 @@ var expectations = { 'Referer header': 'referer: '+(location.href.replace(/[^/]*$/, ''))+"resources/workerxhr-origin-referrer.js\n", 'Origin header': 'origin: '+location.protocol+'//'+location.hostname+'\n', - 'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.php?full' + 'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.py?full' } // now start the worker var worker = new Worker("resources/workerxhr-origin-referrer.js", true) diff --git a/XMLHttpRequest/overridemimetype-done-state.htm b/XMLHttpRequest/overridemimetype-done-state.htm index 6467399..73495f5 100644 --- a/XMLHttpRequest/overridemimetype-done-state.htm +++ b/XMLHttpRequest/overridemimetype-done-state.htm
@@ -18,7 +18,7 @@ assert_equals(client.responseXML, null); test.done(); }); - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/plain;charset=iso-8859-1')+'&content=%3Cmsg%3E%83%65%83%58%83%67%3C%2Fmsg%3E'); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/plain;charset=iso-8859-1')+'&content=%3Cmsg%3E%83%65%83%58%83%67%3C%2Fmsg%3E'); client.send(); </script> diff --git a/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm b/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm index 2aa1fd2..b502818 100644 --- a/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm +++ b/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm
@@ -27,7 +27,7 @@ assert_equals( client.responseText, 'テスト', 'overrideMimeType() in HEADERS RECEIVED state set encoding' ); test.done(); }); - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/html;charset=UTF-8')+'&content=%83%65%83%58%83%67'); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/html;charset=UTF-8')+'&content=%83%65%83%58%83%67'); client.send( '' ); </script> </body> diff --git a/XMLHttpRequest/overridemimetype-loading-state.htm b/XMLHttpRequest/overridemimetype-loading-state.htm index a1aa586..8d78c60 100644 --- a/XMLHttpRequest/overridemimetype-loading-state.htm +++ b/XMLHttpRequest/overridemimetype-loading-state.htm
@@ -21,7 +21,7 @@ test.done(); } }; - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/plain;charset=iso-8859-1')+'&content=%3Cmsg%3E%83%65%83%58%83%67%3C%2Fmsg%3E'); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/plain;charset=iso-8859-1')+'&content=%3Cmsg%3E%83%65%83%58%83%67%3C%2Fmsg%3E'); client.send(); }); </script> diff --git a/XMLHttpRequest/overridemimetype-open-state-force-utf-8.htm b/XMLHttpRequest/overridemimetype-open-state-force-utf-8.htm index b552af9..d6c2fa7 100644 --- a/XMLHttpRequest/overridemimetype-open-state-force-utf-8.htm +++ b/XMLHttpRequest/overridemimetype-open-state-force-utf-8.htm
@@ -18,7 +18,7 @@ assert_equals( client.responseText, 'テスト' ); test.done(); }; - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/html;charset=Shift-JIS')+'&content='+encodeURIComponent('テスト')); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/html;charset=Shift-JIS')+'&content='+encodeURIComponent('テスト')); client.overrideMimeType('text/plain;charset=UTF-8'); client.send( '' ); }); diff --git a/XMLHttpRequest/overridemimetype-open-state-force-xml.htm b/XMLHttpRequest/overridemimetype-open-state-force-xml.htm index 4f74274..7d92ab5 100644 --- a/XMLHttpRequest/overridemimetype-open-state-force-xml.htm +++ b/XMLHttpRequest/overridemimetype-open-state-force-xml.htm
@@ -25,7 +25,7 @@ assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello World!' ); test.done(); }; - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/plain;charset=Shift-JIS')+'&content='+encodeURIComponent('<test><message>Hello World!</message></test>')); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/plain;charset=Shift-JIS')+'&content='+encodeURIComponent('<test><message>Hello World!</message></test>')); client.overrideMimeType('application/xml;charset=UTF-8'); client.send(); }); diff --git a/XMLHttpRequest/overridemimetype-unsent-state-force-shiftjis.htm b/XMLHttpRequest/overridemimetype-unsent-state-force-shiftjis.htm index 1bb74a6..8b68dc5 100644 --- a/XMLHttpRequest/overridemimetype-unsent-state-force-shiftjis.htm +++ b/XMLHttpRequest/overridemimetype-unsent-state-force-shiftjis.htm
@@ -19,7 +19,7 @@ assert_equals( client.responseText, 'テスト' ); test.done(); }; - client.open("GET", "resources/status.php?type="+encodeURIComponent('text/html;charset=iso-8859-1')+'&content=%83%65%83%58%83%67'); + client.open("GET", "resources/status.py?type="+encodeURIComponent('text/html;charset=iso-8859-1')+'&content=%83%65%83%58%83%67'); client.send( '' ); }); </script> diff --git a/XMLHttpRequest/resources/accept-language.php b/XMLHttpRequest/resources/accept-language.php deleted file mode 100644 index c239016..0000000 --- a/XMLHttpRequest/resources/accept-language.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php - header("Content-Type:text/plain"); - echo isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "NO"; - exit; -?> diff --git a/XMLHttpRequest/resources/accept-language.py b/XMLHttpRequest/resources/accept-language.py new file mode 100644 index 0000000..e0fd30c --- /dev/null +++ b/XMLHttpRequest/resources/accept-language.py
@@ -0,0 +1,4 @@ +def main(request, response): + return [("Content-Type", "text/plain"), + request.headers.get("Accept-Language", "NO")] + diff --git a/XMLHttpRequest/resources/accept.php b/XMLHttpRequest/resources/accept.php deleted file mode 100644 index 6877c91..0000000 --- a/XMLHttpRequest/resources/accept.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php - header("Content-Type:text/plain"); - echo isset($_SERVER["HTTP_ACCEPT"]) ? $_SERVER["HTTP_ACCEPT"] : "NO"; - exit; -?> diff --git a/XMLHttpRequest/resources/accept.py b/XMLHttpRequest/resources/accept.py new file mode 100644 index 0000000..2fdf210 --- /dev/null +++ b/XMLHttpRequest/resources/accept.py
@@ -0,0 +1,3 @@ +def main(request, response): + return [("Content-Type", "text/plain")], request.headers.get("accept", "NO") + diff --git a/XMLHttpRequest/resources/auth1/auth.php b/XMLHttpRequest/resources/auth1/auth.php deleted file mode 100644 index 7b493a9..0000000 --- a/XMLHttpRequest/resources/auth1/auth.php +++ /dev/null
@@ -1,32 +0,0 @@ -<?php - $session_user = isset($_SERVER["PHP_AUTH_USER"]) ? $_SERVER["PHP_AUTH_USER"] : null; - $session_pass = isset($_SERVER["PHP_AUTH_PW"]) ? $_SERVER["PHP_AUTH_PW"] : null; - $xhr_user = isset($_SERVER["HTTP_X_USER"]) ? $_SERVER["HTTP_X_USER"] : null; - $xhr_pass = isset($_SERVER["HTTP_X_PASS"]) ? $_SERVER["HTTP_X_PASS"] : null; - $file = "authentication-temp-" . $xhr_user; - - if(empty($session_user) && empty($session_pass)) { - if(file_exists($file)) { - unlink($file); - echo 'FAIL (did not send authentication in response to challenge)'; - exit; - } else { - $handler = fopen($file, 'w'); - fclose($handler); - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - echo 'FAIL (should be transparent)'; - } - } else { // we received user and pass arguments - header('XHR-USER: ' . $xhr_user); - header('SES-USER: ' . $session_user); - - if(file_exists($file)) { - header("X-challenge: DID"); - unlink($file); - }else{ - header("X-challenge: DID-NOT"); - } - echo $session_user . "\n" . $session_pass; - } -?> diff --git a/XMLHttpRequest/resources/auth1/auth.py b/XMLHttpRequest/resources/auth1/auth.py new file mode 100644 index 0000000..621d18e --- /dev/null +++ b/XMLHttpRequest/resources/auth1/auth.py
@@ -0,0 +1,9 @@ +import imp +import os + +def main(request, response): + auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), + "XMLHttpRequest", + "resources", + "authentication.py")) + return auth.main(request, response) diff --git a/XMLHttpRequest/resources/auth1/corsenabled.php b/XMLHttpRequest/resources/auth1/corsenabled.php deleted file mode 100644 index 4c909cd..0000000 --- a/XMLHttpRequest/resources/auth1/corsenabled.php +++ /dev/null
@@ -1,39 +0,0 @@ -<?php - $session_user = isset($_SERVER["PHP_AUTH_USER"]) ? $_SERVER["PHP_AUTH_USER"] : null; - $session_pass = isset($_SERVER["PHP_AUTH_PW"]) ? $_SERVER["PHP_AUTH_PW"] : null; - $xhr_user = isset($_SERVER["HTTP_X_USER"]) ? $_SERVER["HTTP_X_USER"] : null; - $xhr_pass = isset($_SERVER["HTTP_X_PASS"]) ? $_SERVER["HTTP_X_PASS"] : null; - $file = "authentication-temp-cors-" . $xhr_user; - // mark this resource as super-CORS-friendly.. - header('Access-Control-Allow-Origin: *'); - header('Access-Control-Allow-Credentials: true'); - header('Access-Control-Allow-Methods: GET'); - header('Access-Control-Allow-Headers: authorization, x-user, x-pass'); - header('Access-Control-Expose-Headers: x-challenge, xhr-user, ses-user'); - if(empty($session_user) && empty($session_pass)) { - if(file_exists($file)) { - unlink($file); - echo 'FAIL (did not send authentication in response to challenge)'; - exit; - } else { - $handler = fopen($file, 'w'); - fclose($handler); - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - echo 'FAIL (should be transparent)'; - } - } else { // we received user and pass arguments - header('XHR-USER: ' . $xhr_user); - header('SES-USER: ' . $session_user); - - if(file_exists($file)) { - header("X-challenge: DID"); - unlink($file); - }else{ - header("X-challenge: DID-NOT"); - } - if ($_SERVER['REQUEST_METHOD'] === 'GET') { - echo $session_user . "\n" . $session_pass; - } - } -?> diff --git a/XMLHttpRequest/resources/auth2/auth.php b/XMLHttpRequest/resources/auth2/auth.php deleted file mode 100644 index 67a37d7..0000000 --- a/XMLHttpRequest/resources/auth2/auth.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php -// we want different directories to give the browser the impression that we have different realms, -// but actually we don't really want to duplicate the backend scripts.. so.. -require('../auth1/auth.php') -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth2/auth.py b/XMLHttpRequest/resources/auth2/auth.py new file mode 100644 index 0000000..621d18e --- /dev/null +++ b/XMLHttpRequest/resources/auth2/auth.py
@@ -0,0 +1,9 @@ +import imp +import os + +def main(request, response): + auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), + "XMLHttpRequest", + "resources", + "authentication.py")) + return auth.main(request, response) diff --git a/XMLHttpRequest/resources/auth2/corsenabled.php b/XMLHttpRequest/resources/auth2/corsenabled.php deleted file mode 100644 index eea4683..0000000 --- a/XMLHttpRequest/resources/auth2/corsenabled.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php -// we want different directories to give the browser the impression that we have different realms, -// but actually we don't really want to duplicate the backend scripts.. so.. -require('../auth1/corsenabled.php') -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth2/corsenabled.py b/XMLHttpRequest/resources/auth2/corsenabled.py new file mode 100644 index 0000000..27f3962 --- /dev/null +++ b/XMLHttpRequest/resources/auth2/corsenabled.py
@@ -0,0 +1,20 @@ +import imp +import os + +def main(request, response): + response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin")); + response.headers.set('Access-Control-Allow-Credentials', 'true'); + response.headers.set('Access-Control-Allow-Methods', 'GET'); + response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass'); + response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user'); + auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), + "XMLHttpRequest", + "resources", + "authentication.py")) + if request.method == "OPTIONS": + return "" + else: + return auth.main(request, response) + + + diff --git a/XMLHttpRequest/resources/auth3/auth.php b/XMLHttpRequest/resources/auth3/auth.php deleted file mode 100644 index 67a37d7..0000000 --- a/XMLHttpRequest/resources/auth3/auth.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php -// we want different directories to give the browser the impression that we have different realms, -// but actually we don't really want to duplicate the backend scripts.. so.. -require('../auth1/auth.php') -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth3/auth.py b/XMLHttpRequest/resources/auth3/auth.py new file mode 100644 index 0000000..621d18e --- /dev/null +++ b/XMLHttpRequest/resources/auth3/auth.py
@@ -0,0 +1,9 @@ +import imp +import os + +def main(request, response): + auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), + "XMLHttpRequest", + "resources", + "authentication.py")) + return auth.main(request, response) diff --git a/XMLHttpRequest/resources/auth3/corsenabled.php b/XMLHttpRequest/resources/auth3/corsenabled.php deleted file mode 100644 index eea4683..0000000 --- a/XMLHttpRequest/resources/auth3/corsenabled.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php -// we want different directories to give the browser the impression that we have different realms, -// but actually we don't really want to duplicate the backend scripts.. so.. -require('../auth1/corsenabled.php') -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth4/auth.php b/XMLHttpRequest/resources/auth4/auth.php deleted file mode 100644 index 67a37d7..0000000 --- a/XMLHttpRequest/resources/auth4/auth.php +++ /dev/null
@@ -1,5 +0,0 @@ -<?php -// we want different directories to give the browser the impression that we have different realms, -// but actually we don't really want to duplicate the backend scripts.. so.. -require('../auth1/auth.php') -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth4/auth.py b/XMLHttpRequest/resources/auth4/auth.py new file mode 100644 index 0000000..621d18e --- /dev/null +++ b/XMLHttpRequest/resources/auth4/auth.py
@@ -0,0 +1,9 @@ +import imp +import os + +def main(request, response): + auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), + "XMLHttpRequest", + "resources", + "authentication.py")) + return auth.main(request, response) diff --git a/XMLHttpRequest/resources/auth5/auth.php b/XMLHttpRequest/resources/auth5/auth.php deleted file mode 100644 index 768a9af..0000000 --- a/XMLHttpRequest/resources/auth5/auth.php +++ /dev/null
@@ -1,13 +0,0 @@ -<?php -if ($_SERVER['PHP_AUTH_USER'] == 'usr' && $_SERVER['PHP_AUTH_PW'] == 'secret') { - header('Content-type: text/plain'); -}else{ - header('Status: 401 Authorization required'); - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - echo('User name/password wrong or not given: '); -} - -echo $_SERVER['PHP_AUTH_USER'] . "\n" . $_SERVER['PHP_AUTH_PW']; - -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth5/auth.py b/XMLHttpRequest/resources/auth5/auth.py new file mode 100644 index 0000000..f542873 --- /dev/null +++ b/XMLHttpRequest/resources/auth5/auth.py
@@ -0,0 +1,13 @@ +def main(request, response): + if request.auth.username == 'usr' and request.auth.password == 'secret': + response.headers.set('Content-type', 'text/plain') + content = "" + else: + response.status = 401 + response.headers.set('Status', '401 Authorization required') + response.headers.set('WWW-Authenticate', 'Basic realm="test"') + content = 'User name/password wrong or not given: ' + + content += "%s\n%s" % (request.auth.username, + request.auth.password) + return content diff --git a/XMLHttpRequest/resources/auth6/auth.php b/XMLHttpRequest/resources/auth6/auth.php deleted file mode 100644 index 768a9af..0000000 --- a/XMLHttpRequest/resources/auth6/auth.php +++ /dev/null
@@ -1,13 +0,0 @@ -<?php -if ($_SERVER['PHP_AUTH_USER'] == 'usr' && $_SERVER['PHP_AUTH_PW'] == 'secret') { - header('Content-type: text/plain'); -}else{ - header('Status: 401 Authorization required'); - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - echo('User name/password wrong or not given: '); -} - -echo $_SERVER['PHP_AUTH_USER'] . "\n" . $_SERVER['PHP_AUTH_PW']; - -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth6/auth.py b/XMLHttpRequest/resources/auth6/auth.py new file mode 100644 index 0000000..f542873 --- /dev/null +++ b/XMLHttpRequest/resources/auth6/auth.py
@@ -0,0 +1,13 @@ +def main(request, response): + if request.auth.username == 'usr' and request.auth.password == 'secret': + response.headers.set('Content-type', 'text/plain') + content = "" + else: + response.status = 401 + response.headers.set('Status', '401 Authorization required') + response.headers.set('WWW-Authenticate', 'Basic realm="test"') + content = 'User name/password wrong or not given: ' + + content += "%s\n%s" % (request.auth.username, + request.auth.password) + return content diff --git a/XMLHttpRequest/resources/authentication.php b/XMLHttpRequest/resources/authentication.php deleted file mode 100644 index 7322361..0000000 --- a/XMLHttpRequest/resources/authentication.php +++ /dev/null
@@ -1,40 +0,0 @@ -<?php - if (isset($_GET['logout'])) { - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - die("Logged out, hopefully"); - } - - $session_user = isset($_SERVER["PHP_AUTH_USER"]) ? $_SERVER["PHP_AUTH_USER"] : null; - $session_pass = isset($_SERVER["PHP_AUTH_PW"]) ? $_SERVER["PHP_AUTH_PW"] : null; - $expected_user_name = isset($_SERVER["HTTP_X_USER"]) ? $_SERVER["HTTP_X_USER"] : null; - $expected_user_password = isset($_SERVER["HTTP_X_PASS"]) ? $_SERVER["HTTP_X_PASS"] : null; - $file = "authentication-temp-" . $expected_user_name; - if((empty($session_user) && empty($session_pass))/* || - ($session_user != $expected_user_name || $session_pass != $expected_user_password)*/ - ) { - if(file_exists($file)) { - unlink($file); - echo 'FAIL (did not challenge)'; - exit; - } else { - $handler = fopen($file, 'w'); - fclose($handler); - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Basic realm="test"'); - header('XHR-USER: ' . $expected_user_name); - header('SES-USER: ' . $session_user); - echo 'FAIL (should be transparent)'; - } - } else { - header('XHR-USER: ' . $expected_user_name); - header('SES-USER: ' . $session_user); - if(!file_exists($file)) { - header("X-challenge: DID-NOT"); - }else{ - header("X-challenge: DID"); - unlink($file); - } - echo $session_user . "\n" . $session_pass; - } -?> diff --git a/XMLHttpRequest/resources/authentication.py b/XMLHttpRequest/resources/authentication.py new file mode 100644 index 0000000..4f65fa2 --- /dev/null +++ b/XMLHttpRequest/resources/authentication.py
@@ -0,0 +1,32 @@ +def main(request, response): + if "logout" in request.GET: + return ((401, "Unauthorized"), + [("WWW-Authenticate", 'Basic realm="test"')], + "Logged out, hopefully") + + session_user = request.auth.username + session_pass = request.auth.password + expected_user_name = request.headers.get("X-User", None) + + token = expected_user_name + if session_user is None and session_pass is None: + if token is not None and request.server.stash.take(token) is not None: + return 'FAIL (did not authorize)' + else: + if token is not None: + request.server.stash.put(token, "1") + status = (401, 'Unauthorized') + headers = [('WWW-Authenticate', 'Basic realm="test"'), + ('XHR-USER', expected_user_name), + ('SES-USER', session_user)] + return status, headers, 'FAIL (should be transparent)' + else: + if request.server.stash.take(token) == "1": + challenge = "DID" + else: + challenge = "DID-NOT" + headers = [('XHR-USER', expected_user_name), + ('SES-USER', session_user), + ("X-challenge", challenge)] + return headers, session_user + "\n" + session_pass; + diff --git a/XMLHttpRequest/resources/chunked.php b/XMLHttpRequest/resources/chunked.php deleted file mode 100644 index e63a59a..0000000 --- a/XMLHttpRequest/resources/chunked.php +++ /dev/null
@@ -1,27 +0,0 @@ -<?php - // This code to turn gzip off is at attempt to get the test to run better on w3c-test.org - if(ini_get('zlib.output_compression')){ - ini_set('zlib.output_compression', 'Off'); - } - @apache_setenv('no-gzip', 1); - // Done (hopefully) disabling gzip - $chunks = Array( - "First chunk\r\n", - "Second chunk\r\n", - "Yet another (third) chunk\r\n", - "Yet another (fourth) chunk\r\n", - ); - header("Transfer-Encoding: chunked"); - header("Trailer: X-Test-Me"); - header("Content-Type: text/plain"); - flush(); - - foreach ($chunks as $key => $value) { - echo sprintf("%x\r\n", strlen($value)); - echo $value; - echo "\r\n"; - //sleep(0.5); - } - echo "0\r\n"; - echo "X-Test-Me: Trailer header value\r\n\r\n" -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/chunked.py b/XMLHttpRequest/resources/chunked.py new file mode 100644 index 0000000..7f9570a --- /dev/null +++ b/XMLHttpRequest/resources/chunked.py
@@ -0,0 +1,18 @@ +def main(request, response): + chunks = ["First chunk\r\n", + "Second chunk\r\n", + "Yet another (third) chunk\r\n", + "Yet another (fourth) chunk\r\n", + ] + response.headers.set("Transfer-Encoding", "chunked"); + response.headers.set("Trailer", "X-Test-Me"); + response.headers.set("Content-Type", "text/plain"); + response.writer.flush() + + for value in chunks: + response.writer.write("%d\r\n" % len(value)) + response.writer.write(value) + response.writer.write("\r\n") + response.writer.write("0\r\n") + response.writer.write("X-Test-Me: Trailer header value\r\n\r\n") + diff --git a/XMLHttpRequest/resources/conditional.php b/XMLHttpRequest/resources/conditional.php deleted file mode 100644 index 2d1058c..0000000 --- a/XMLHttpRequest/resources/conditional.php +++ /dev/null
@@ -1,19 +0,0 @@ -<?php - $tag = isset($_GET["tag"]) ? $_GET["tag"] : ""; - $match = isset($_SERVER["HTTP_IF_NONE_MATCH"]) ? $_SERVER["HTTP_IF_NONE_MATCH"] : ""; - $date = isset($_GET["date"]) ? $_GET["date"] : ""; - $modified = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) ? $_SERVER["HTTP_IF_MODIFIED_SINCE"] : ""; - if(!empty($tag)) { - header("ETag: \"" . $tag . "\""); - } elseif(!empty($date)) { - header("Last-Modified: " . $date); - } - if((!empty($match) && $match == $tag) || - (!empty($modified) && $modified == $date)) { - header("HTTP/1.1 304 SUPERCOOL"); - exit; - } - header("Content-Type:text/plain"); - echo "MAYBE NOT"; - exit; -?> diff --git a/XMLHttpRequest/resources/conditional.py b/XMLHttpRequest/resources/conditional.py new file mode 100644 index 0000000..42dfecd --- /dev/null +++ b/XMLHttpRequest/resources/conditional.py
@@ -0,0 +1,17 @@ +def main(request, response): + tag = request.GET.first("tag", None) + match = request.headers.get("If-None-Match", None) + date = request.GET.first("date", "") + modified = request.headers.get("If-Modified-Since", None) + if tag: + response.headers.set("ETag", '"%s"' % tag) + elif date: + response.headers.set("Last-Modified", date) + + if ((match is not None and match == tag) or + (modified is not None and modified == date)): + response.status = (304, "SUPERCOOL") + return "" + else: + response.headers.set("Content-Type", "text/plain") + return "MAYBE NOT" diff --git a/XMLHttpRequest/resources/content.php b/XMLHttpRequest/resources/content.php deleted file mode 100644 index 3d46f5f..0000000 --- a/XMLHttpRequest/resources/content.php +++ /dev/null
@@ -1,16 +0,0 @@ -<?php - header("Content-type: text/plain"); - header("X-Request-Method: " . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "NO")); - header("X-Request-Query: " . (isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : "NO")); - header("X-Request-Content-Length: " . (isset($_SERVER["CONTENT_LENGTH"]) ? $_SERVER["CONTENT_LENGTH"] : "NO")); - header("X-Request-Content-Type: " . (isset($_SERVER["CONTENT_TYPE"]) ? $_SERVER["CONTENT_TYPE"] : "NO")); -if (isset($_GET["content"])) -{ - echo $_GET["content"]; -} -else -{ - echo file_get_contents("php://input"); -} -exit; -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/content.py b/XMLHttpRequest/resources/content.py new file mode 100644 index 0000000..1c53d91 --- /dev/null +++ b/XMLHttpRequest/resources/content.py
@@ -0,0 +1,13 @@ +def main(request, response): + headers = [("Content-type", "text/plain"), + ("X-Request-Method", request.method), + ("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"), + ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), + ("X-Request-Content-Type", request.headers.get("Content-Type", "NO"))] + + if "content" in request.GET: + content = request.GET.first("content") + else: + content = request.body + + return headers, content diff --git a/XMLHttpRequest/resources/corsenabled.php b/XMLHttpRequest/resources/corsenabled.php deleted file mode 100644 index d14815d..0000000 --- a/XMLHttpRequest/resources/corsenabled.php +++ /dev/null
@@ -1,15 +0,0 @@ -<?php - // mark this resource as super-CORS-friendly.. - header('Access-Control-Allow-Origin: *'); - header('Access-Control-Allow-Credentials: true'); - header('Access-Control-Allow-Methods: GET, POST, PUT, FOO'); - header('Access-Control-Allow-Headers: x-test, x-foo'); - header('Access-Control-Expose-Headers: x-request-method, x-request-content-type, x-request-query, x-request-content-length'); - if(isset($_GET['delay'])){ - sleep($_GET['delay']); - } - header("X-Request-Method: " . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "NO")); - header("X-Request-Query: " . (isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : "NO")); - header("X-Request-Content-Length: " . (isset($_SERVER["CONTENT_LENGTH"]) ? $_SERVER["CONTENT_LENGTH"] : "NO")); - header("X-Request-Content-Type: " . (isset($_SERVER["CONTENT_TYPE"]) ? $_SERVER["CONTENT_TYPE"] : "NO")); -?> diff --git a/XMLHttpRequest/resources/corsenabled.py b/XMLHttpRequest/resources/corsenabled.py new file mode 100644 index 0000000..d61f85d --- /dev/null +++ b/XMLHttpRequest/resources/corsenabled.py
@@ -0,0 +1,19 @@ +import time + +def main(request, response): + headers = [("Access-Control-Allow-Origin", "*"), + ("Access-Control-Allow-Credentials", "true"), + ("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"), + ("Access-Control-Allow-Headers", "x-test, x-foo"), + ("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length")] + + if "delay" in request.GET: + delay = int(request.GET.first("delay")) + time.sleep(delay) + + headers.append(("X-Request-Method", request.method)) + headers.append(("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO")) + headers.append(("X-Request-Content-Length", request.headers.get("Content-Length", "NO"))) + headers.append(("X-Request-Content-Type", request.headers.get("Content-Type", "NO"))) + + return headers, "Test" diff --git a/XMLHttpRequest/resources/delay.php b/XMLHttpRequest/resources/delay.php deleted file mode 100644 index 1be9337..0000000 --- a/XMLHttpRequest/resources/delay.php +++ /dev/null
@@ -1,9 +0,0 @@ -<?php - // It will always output a text file for now with the literal string - // "TEST_DELAY" - $delay = isset($_GET["ms"]) && ctype_digit($_GET["ms"]) ? $_GET["ms"] : 500; - usleep($delay); - header("Content-type: text/plain"); - echo "TEST_DELAY"; - exit; -?> diff --git a/XMLHttpRequest/resources/delay.py b/XMLHttpRequest/resources/delay.py new file mode 100644 index 0000000..bdfef9b --- /dev/null +++ b/XMLHttpRequest/resources/delay.py
@@ -0,0 +1,6 @@ +import time + +def main(request, response): + delay = float(request.GET.first("ms", 500)) + time.sleep(delay / 1E3); + return [("Content-type", "text/plain")], "TEST_DELAY" diff --git a/XMLHttpRequest/resources/form.php b/XMLHttpRequest/resources/form.php deleted file mode 100644 index 8396bc7..0000000 --- a/XMLHttpRequest/resources/form.php +++ /dev/null
@@ -1,8 +0,0 @@ -<?php - echo "id:"; - echo $_POST["id"]; - echo ";"; - echo "value:"; - echo $_POST["value"]; - echo ";"; -?>
diff --git a/XMLHttpRequest/resources/form.py b/XMLHttpRequest/resources/form.py new file mode 100644 index 0000000..aa5f764 --- /dev/null +++ b/XMLHttpRequest/resources/form.py
@@ -0,0 +1,2 @@ +def main(request, response): + return "id:%s;value:%s;" % (request.POST.first("id"), request.POST.first("value")) diff --git a/XMLHttpRequest/resources/gzip.php b/XMLHttpRequest/resources/gzip.php deleted file mode 100644 index 1b34bdd..0000000 --- a/XMLHttpRequest/resources/gzip.php +++ /dev/null
@@ -1,25 +0,0 @@ -<?php - -if (isset($_GET["content"])) -{ - $output = $_GET["content"]; -} -else -{ - $output = file_get_contents("php://input"); -} - -$output = gzencode($output, 9, FORCE_GZIP); - -header("Content-type: text/plain"); -header("Content-Encoding: gzip"); -header("X-Request-Method: " . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "NO")); -header("X-Request-Query: " . (isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : "NO")); -header("X-Request-Content-Length: " . (isset($_SERVER["CONTENT_LENGTH"]) ? $_SERVER["CONTENT_LENGTH"] : "NO")); -header("X-Request-Content-Type: " . (isset($_SERVER["CONTENT_TYPE"]) ? $_SERVER["CONTENT_TYPE"] : "NO")); -header("Content-Length: ".strlen($output)); - -echo $output; - -exit; -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/gzip.py b/XMLHttpRequest/resources/gzip.py new file mode 100644 index 0000000..e09a823 --- /dev/null +++ b/XMLHttpRequest/resources/gzip.py
@@ -0,0 +1,19 @@ +import zlib + +def main(request, response): + if "content" in request.GET: + output = request.GET["content"] + else: + output = request.body + + output = zlib.compress(output, 9) + + headers = [("Content-type", "text/plain"), + ("Content-Encoding", "gzip"), + ("X-Request-Method", request.method), + ("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"), + ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), + ("X-Request-Content-Type", request.headers.get("Content-Type", "NO")), + ("Content-Length", len(output))] + + return headers, output diff --git a/XMLHttpRequest/resources/headers.php b/XMLHttpRequest/resources/headers.php deleted file mode 100644 index eab37a9..0000000 --- a/XMLHttpRequest/resources/headers.php +++ /dev/null
@@ -1,11 +0,0 @@ -<?php - header("Content-Type: text/plain"); - header("X-Custom-Header: test"); - header("Set-Cookie: test"); - header("Set-Cookie2: test"); - header("X-Custom-Header-Empty:"); - header("X-Custom-Header-Comma: 1"); - header("X-Custom-Header-Comma: 2", false); - header("X-Custom-Header-Bytes: …"); - echo "TEST"; -?> diff --git a/XMLHttpRequest/resources/headers.py b/XMLHttpRequest/resources/headers.py new file mode 100644 index 0000000..cefa8ee --- /dev/null +++ b/XMLHttpRequest/resources/headers.py
@@ -0,0 +1,12 @@ + # -*- coding: utf-8 -*- + +def main(request, response): + response.headers.set("Content-Type", "text/plain") + response.headers.set("X-Custom-Header", "test") + response.headers.set("Set-Cookie", "test") + response.headers.set("Set-Cookie2", "test") + response.headers.set("X-Custom-Header-Empty", "") + response.headers.set("X-Custom-Header-Comma", "1") + response.headers.append("X-Custom-Header-Comma", "2") + response.headers.set("X-Custom-Header-Bytes", "…") + return "TEST" diff --git a/XMLHttpRequest/resources/infinite-redirects.php b/XMLHttpRequest/resources/infinite-redirects.php deleted file mode 100644 index b84597b..0000000 --- a/XMLHttpRequest/resources/infinite-redirects.php +++ /dev/null
@@ -1,23 +0,0 @@ -<?php - // The infinite redirect script. - $location = "http://".$_SERVER['HTTP_HOST'].$_SERVER ['SCRIPT_NAME']; //"/support/infinite-redirect"; - $page = "alternate"; - $type = 302; - $mix = 0; - if(isset($_GET["page"]) && $_GET["page"] == "alternate") { - $page = "default"; - } - if(isset($_GET["type"]) && (int) $_GET["type"] == 301) { - $type = 301; - } - if(isset($_GET["mix"]) && (int) $_GET["mix"] == 1) { - $mix = 1; - $type = $type == 301 ? 302 : 301; - } - $newLocation = $location . "?page=" . $page . "&type=" . $type . "&mix=" . $mix; - header("Cache-Control: no-cache"); - header("Pragma: no-cache"); - header("Location: " . $newLocation, true, 301); - - echo "Hello guest. You have been redirected to ".$newLocation; -?> diff --git a/XMLHttpRequest/resources/infinite-redirects.py b/XMLHttpRequest/resources/infinite-redirects.py new file mode 100644 index 0000000..b508c5b --- /dev/null +++ b/XMLHttpRequest/resources/infinite-redirects.py
@@ -0,0 +1,24 @@ +def main(request, response): + location = "%s://%s:%s/%s" % (request.url_parts.scheme, + request.url_parts.netloc, + request.url_parts.port, + request.url_parts.path) + page = "alternate"; + type = 302; + mix = 0; + if request.GET.first("page", None) == "alternate": + page = "default" + + if request.GET.first("type", None) == "301": + type = 301 + + if request.GET.first("mix", None) == "1": + mix = 1 + type = 302 if type == 301 else 301 + + new_location = "%s?page=%s&type=%s&mix=%s" % (location, page, type, mix) + headers = [("Cache-Control", "no-cache"), + ("Pragma", "no-cache"), + ("Location", new_location)] + return 301, headers, "Hello guest. You have been redirected to " + new_location + diff --git a/XMLHttpRequest/resources/inspect-headers.php b/XMLHttpRequest/resources/inspect-headers.php deleted file mode 100644 index 3196512..0000000 --- a/XMLHttpRequest/resources/inspect-headers.php +++ /dev/null
@@ -1,24 +0,0 @@ -<?php - if(isset($_GET['cors'])){ - // mark this resource as super-CORS-friendly.. - header('Access-Control-Allow-Origin: *'); - header('Access-Control-Allow-Credentials: true'); - header('Access-Control-Allow-Methods: GET, POST, PUT, FOO'); - header('Access-Control-Allow-Headers: x-test, x-foo'); - header('Access-Control-Expose-Headers: x-request-method, x-request-content-type, x-request-query, x-request-content-length'); - } - $filter_value = isset($_GET["filter_value"]) && $_GET["filter_value"] ? $_GET["filter_value"] : ""; - $filter_name = isset($_GET["filter_name"]) && $_GET["filter_name"] ? strtolower($_GET["filter_name"]) : ""; - $result = ""; - foreach (getallheaders() as $name => $value) { - if($filter_value != "") { - if($value == $filter_value) - $result .= strtolower($name) . ","; - }else if (strtolower($name) == $filter_name) { - $result .= strtolower($name) . ": ".$value."\n"; - } - } - header("content-type:text/plain"); - echo $result; - exit; -?> diff --git a/XMLHttpRequest/resources/inspect-headers.py b/XMLHttpRequest/resources/inspect-headers.py new file mode 100644 index 0000000..ca59605 --- /dev/null +++ b/XMLHttpRequest/resources/inspect-headers.py
@@ -0,0 +1,22 @@ +def main(request, response): + headers = [] + if "cors" in request.GET: + headers.append(("Access-Control-Allow-Origin", "*")) + headers.append(("Access-Control-Allow-Credentials", "true")) + headers.append(("Access-Control-Allow-Methods", "GET, POST, PUT, FOO")) + headers.append(("Access-Control-Allow-Headers", "x-test, x-foo")) + headers.append(("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length")) + + filter_value = request.GET.first("filter_value", "") + filter_name = request.GET.first("filter_name", "").lower() + + result = "" + for name, value in request.headers.iteritems(): + if filter_value: + if value == filter_value: + result += name.lower() + "," + elif name.lower() == filter_name: + result += name.lower() + ": " + value + "\n"; + + headers.append(("content-type", "text/plain")) + return headers, result diff --git a/XMLHttpRequest/resources/redirect.php b/XMLHttpRequest/resources/redirect.php deleted file mode 100644 index f5103a1..0000000 --- a/XMLHttpRequest/resources/redirect.php +++ /dev/null
@@ -1,15 +0,0 @@ -<?php - $code = ctype_digit($_GET["code"]) ? $_GET["code"] : "302"; - $location = $_GET["location"] ? $_GET["location"] : $_SERVER["SCRIPT_NAME"] . "?followed"; - - if($_SERVER["QUERY_STRING"] == "followed") { - header("Content:Type:text/plain"); - echo "MAGIC HAPPENED"; - exit; - } - - header("HTTP/1.1 " . $code . " WEBSRT MARKETING"); - header("Location: " . $location); - echo "TEST"; - exit; -?> diff --git a/XMLHttpRequest/resources/redirect.py b/XMLHttpRequest/resources/redirect.py new file mode 100644 index 0000000..6ec9349 --- /dev/null +++ b/XMLHttpRequest/resources/redirect.py
@@ -0,0 +1,8 @@ +def main(request, response): + code = int(request.GET.first("code", 302)) + location = request.GET.first("location", request.url_parts.path +"?followed") + + if request.url.endswith("?followed"): + return [("Content:Type", "text/plain")], "MAGIC HAPPENED" + else: + return (code, "WEBSRT MARKETING"), [("Location", location)], "TEST" diff --git a/XMLHttpRequest/resources/requri.php b/XMLHttpRequest/resources/requri.php deleted file mode 100644 index 7bc19cd..0000000 --- a/XMLHttpRequest/resources/requri.php +++ /dev/null
@@ -1,7 +0,0 @@ -<?php -if (isset($_GET['full'])) { - echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; -}else{ - echo $_SERVER['REQUEST_URI']; -} -?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/requri.py b/XMLHttpRequest/resources/requri.py new file mode 100644 index 0000000..554913a --- /dev/null +++ b/XMLHttpRequest/resources/requri.py
@@ -0,0 +1,6 @@ +def main(request, response): + if "full" in request.GET: + return request.url + else: + return request.request_path +
diff --git a/XMLHttpRequest/resources/status.php b/XMLHttpRequest/resources/status.php deleted file mode 100644 index 07eeb70..0000000 --- a/XMLHttpRequest/resources/status.php +++ /dev/null
@@ -1,23 +0,0 @@ -<?php - // Hack for PHP - function stripslashes_recursive($var) { - foreach($var as $i => $value) - $var[$i] = stripslashes($value); - return $var; - } - if(get_magic_quotes_gpc()) { - $_GET = stripslashes_recursive($_GET); - } - - // This should reasonably work for most response codes. - $code = isset($_GET['code']) && ctype_digit($_GET["code"]) ? $_GET["code"] : "200"; - $text = isset($_GET['text']) && $_GET["text"] ? $_GET["text"] : "OMG"; - $content = $_GET["content"] ? $_GET["content"] : ""; - $type = $_GET["type"] ? $_GET["type"] : ""; - header("HTTP/1.1 " . $code . " " . $text); - header("Content-Type:" . $type); - header("X-Request-Method: " . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "NO")); - - echo $content; - exit; -?> diff --git a/XMLHttpRequest/resources/status.py b/XMLHttpRequest/resources/status.py new file mode 100644 index 0000000..5d72e10 --- /dev/null +++ b/XMLHttpRequest/resources/status.py
@@ -0,0 +1,9 @@ +def main(request, response): + code = int(request.GET.first("code", 200)) + text = request.GET.first("text", "OMG") + content = request.GET.first("content", "") + type = request.GET.first("type", "") + status = (code, text) + headers = [("Content-Type", type), + ("X-Request-Method", request.method)] + return status, headers, content diff --git a/XMLHttpRequest/resources/trickle.php b/XMLHttpRequest/resources/trickle.php deleted file mode 100644 index 69407c6..0000000 --- a/XMLHttpRequest/resources/trickle.php +++ /dev/null
@@ -1,15 +0,0 @@ -<?php - // It will always output a text file for now with the literal string - // "TEST_DELAY" - $delay = ctype_digit($_GET["ms"]) ? $_GET["ms"] : 500; - $count = ctype_digit($_GET["count"]) ? $_GET["count"] : 50; - usleep($delay); - header("Content-type: text/plain"); - usleep($delay); - for( $i=0; $i<$count; $i++ ){ - echo "TEST_TRICKLE\n"; - flush(); - usleep($delay); - } - exit; -?> diff --git a/XMLHttpRequest/resources/trickle.py b/XMLHttpRequest/resources/trickle.py new file mode 100644 index 0000000..0e70944 --- /dev/null +++ b/XMLHttpRequest/resources/trickle.py
@@ -0,0 +1,12 @@ +import time + +def main(request, response): + delay = float(request.GET.first("ms", 500)) / 1E3 + count = int(request.GET.first("count", 50)) + time.sleep(delay) + response.headers.set("Content-type", "text/plain") + response.write_status_headers() + time.sleep(delay); + for i in xrange(count): + response.writer.write_content("TEST_TRICKLE\n") + time.sleep(delay) diff --git a/XMLHttpRequest/resources/upload.php b/XMLHttpRequest/resources/upload.php deleted file mode 100644 index 978fa0e..0000000 --- a/XMLHttpRequest/resources/upload.php +++ /dev/null
@@ -1,12 +0,0 @@ -<?php -ksort($_POST); -ksort($_FILES); -if (!empty($_POST)) - foreach ($_POST as $k => $v) - echo "{$k}={$v},"; -echo "\n"; -if (!empty($_FILES)) - foreach ($_FILES as $k => $v) - echo "{$k}={$v['name']}:{$v['type']}:{$v['size']},"; - -?> diff --git a/XMLHttpRequest/resources/upload.py b/XMLHttpRequest/resources/upload.py new file mode 100644 index 0000000..a0b44ab --- /dev/null +++ b/XMLHttpRequest/resources/upload.py
@@ -0,0 +1,16 @@ +def main(request, response): + content = [] + print request.POST + + for key, values in sorted(item for item in request.POST.items() if not hasattr(item[1][0], "filename")): + content.append("%s=%s," % (key, values[0])) + content.append("\n") + + for key, values in sorted(item for item in request.POST.items() if hasattr(item[1][0], "filename")): + value = values[0] + content.append("%s=%s:%s:%s," % (key, + value.filename, + value.headers["Content-Type"], + len(value.file.read()))) + + return "".join(content) diff --git a/XMLHttpRequest/resources/xmlhttprequest-timeout.js b/XMLHttpRequest/resources/xmlhttprequest-timeout.js index 4cd2617..829a8ca 100644 --- a/XMLHttpRequest/resources/xmlhttprequest-timeout.js +++ b/XMLHttpRequest/resources/xmlhttprequest-timeout.js
@@ -21,7 +21,7 @@ /* * This should point to a resource that responds with a text/plain resource after a delay of TIME_XHR_LOAD milliseconds. */ -var STALLED_REQUEST_URL = "resources/delay.php?ms=" + (TIME_XHR_LOAD * 1000); +var STALLED_REQUEST_URL = "resources/delay.py?ms=" + (TIME_XHR_LOAD); var inWorker = false; try { diff --git a/XMLHttpRequest/response-data-arraybuffer.htm b/XMLHttpRequest/response-data-arraybuffer.htm index b883a58..edfb91a 100644 --- a/XMLHttpRequest/response-data-arraybuffer.htm +++ b/XMLHttpRequest/response-data-arraybuffer.htm
@@ -41,10 +41,10 @@ } }; - xhr.open("GET", "./resources/content.php?content=Hello", true); + xhr.open("GET", "./resources/content.py?content=Hello", true); xhr.responseType = "arraybuffer"; xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/response-data-blob.htm b/XMLHttpRequest/response-data-blob.htm index 8e3776a..e8c27bb 100644 --- a/XMLHttpRequest/response-data-blob.htm +++ b/XMLHttpRequest/response-data-blob.htm
@@ -27,7 +27,7 @@ test.step(function() { blob = xhr.response; - assert_true(blob instanceof Blob); + assert_true(blob instanceof Blob, 'blob is a Blob'); var reader = new FileReader(); reader.onload = function() @@ -43,10 +43,10 @@ } } - xhr.open("GET", "./resources/content.php?content=" + content, true); + xhr.open("GET", "./resources/content.py?content=" + content, true); xhr.responseType = "blob"; xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/response-data-gzip.htm b/XMLHttpRequest/response-data-gzip.htm index 2ddbb26..a3d2713 100644 --- a/XMLHttpRequest/response-data-gzip.htm +++ b/XMLHttpRequest/response-data-gzip.htm
@@ -14,7 +14,7 @@ test.step(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/gzip.php", false); + client.open("POST", "resources/gzip.py", false); client.onreadystatechange = test.step_func(function () { if (client.readyState === 4) { diff --git a/XMLHttpRequest/response-data-progress.htm b/XMLHttpRequest/response-data-progress.htm index 384a117..804d91b 100644 --- a/XMLHttpRequest/response-data-progress.htm +++ b/XMLHttpRequest/response-data-progress.htm
@@ -39,7 +39,7 @@ } }); - client.open("GET", "resources/trickle.php?count=1000"); + client.open("GET", "resources/trickle.py?count=1000"); client.send(null); }); </script> diff --git a/XMLHttpRequest/response-json.htm b/XMLHttpRequest/response-json.htm index 0122782..fb699c5 100644 --- a/XMLHttpRequest/response-json.htm +++ b/XMLHttpRequest/response-json.htm
@@ -15,7 +15,7 @@ <script> function setupXHR () { var client = new XMLHttpRequest() - client.open('POST', "resources/content.php", false) + client.open('POST', "resources/content.py", false) client.responseType = 'json' return client } diff --git a/XMLHttpRequest/responsetext-decoding.htm b/XMLHttpRequest/responsetext-decoding.htm index 240e0b1..62f7fa7 100644 --- a/XMLHttpRequest/responsetext-decoding.htm +++ b/XMLHttpRequest/responsetext-decoding.htm
@@ -16,7 +16,7 @@ if (responseType !== undefined) { client.responseType = responseType } - client.open("GET", "resources/status.php?content=" + input + "&type=" + encodeURIComponent(type), false) + client.open("GET", "resources/status.py?content=" + input + "&type=" + encodeURIComponent(type), false) client.send(null) assert_equals(client.responseText, output) }, document.title + " (" + type + " " + input + ")") diff --git a/XMLHttpRequest/responsexml-basic.htm b/XMLHttpRequest/responsexml-basic.htm index 187bbd4..998b2b0 100644 --- a/XMLHttpRequest/responsexml-basic.htm +++ b/XMLHttpRequest/responsexml-basic.htm
@@ -24,7 +24,7 @@ }) test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/status.php?type=application/xml", false) + client.open("GET", "resources/status.py?type=application/xml", false) client.send(null) assert_equals(client.responseXML, null) }, 'responseXML on empty response documents') diff --git a/XMLHttpRequest/responsexml-media-type.htm b/XMLHttpRequest/responsexml-media-type.htm index 25b1c42..4bcb33a 100644 --- a/XMLHttpRequest/responsexml-media-type.htm +++ b/XMLHttpRequest/responsexml-media-type.htm
@@ -13,7 +13,7 @@ function request(type, succeed) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/status.php?content=<x><\/x>&type=" + encodeURIComponent(type), false) + client.open("GET", "resources/status.py?content=<x><\/x>&type=" + encodeURIComponent(type), false) client.send(null) if(!succeed) assert_equals(client.responseXML, null) diff --git a/XMLHttpRequest/responsexml-non-well-formed.htm b/XMLHttpRequest/responsexml-non-well-formed.htm index 018666d..df6d386 100644 --- a/XMLHttpRequest/responsexml-non-well-formed.htm +++ b/XMLHttpRequest/responsexml-non-well-formed.htm
@@ -13,7 +13,7 @@ function request(content) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/status.php?type=text/xml&content=" + encodeURIComponent(content), false) + client.open("GET", "resources/status.py?type=text/xml&content=" + encodeURIComponent(content), false) client.send(null) assert_equals(client.responseXML, null) }) diff --git a/XMLHttpRequest/send-accept-language.htm b/XMLHttpRequest/send-accept-language.htm index c9af6f6..de72320 100644 --- a/XMLHttpRequest/send-accept-language.htm +++ b/XMLHttpRequest/send-accept-language.htm
@@ -11,16 +11,16 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open('GET', 'resources/inspect-headers.php?filter_name=accept-language', false) + client.open('GET', 'resources/inspect-headers.py?filter_name=accept-language', false) client.send(null) assert_regexp_match(client.responseText, /accept-language:\s.+/) }, 'Send "sensible" default value, whatever that means') test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/accept-language.php", false) + client.open("GET", "resources/inspect-headers.py?filter_name=accept-language", false) client.setRequestHeader("Accept-Language", "x-GameSpeak") client.send(null) - assert_equals(client.responseText, "x-GameSpeak") + assert_equals(client.responseText, "accept-language: x-GameSpeak\n") }) </script> </body> diff --git a/XMLHttpRequest/send-accept.htm b/XMLHttpRequest/send-accept.htm index 19cb627..893e323 100644 --- a/XMLHttpRequest/send-accept.htm +++ b/XMLHttpRequest/send-accept.htm
@@ -11,10 +11,10 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/accept.php", false) + client.open("GET", "resources/accept.py", false) client.send(null) assert_equals(client.responseText, "*/*") - client.open("GET", "resources/accept.php", false) + client.open("GET", "resources/accept.py", false) client.setRequestHeader("Accept", "x-something/vague, text/html5") client.send(null) assert_equals(client.responseText, "x-something/vague, text/html5") diff --git a/XMLHttpRequest/send-after-setting-document-domain.htm b/XMLHttpRequest/send-after-setting-document-domain.htm index 37e33b9..321218c 100644 --- a/XMLHttpRequest/send-after-setting-document-domain.htm +++ b/XMLHttpRequest/send-after-setting-document-domain.htm
@@ -18,18 +18,18 @@ test(function() { document.domain = document.domain // this is not a noop, it does actually change the security context var client = new XMLHttpRequest() - client.open("GET", "resources/status.php?content=hello", false) + client.open("GET", "resources/status.py?content=hello", false) client.send(null) assert_equals(client.responseText, "hello") document.domain = document.domain.replace(/^\w+\./, '') - client.open("GET", "resources/status.php?content=hello2", false) + client.open("GET", "resources/status.py?content=hello2", false) client.send(null) assert_equals(client.responseText, "hello2") }, "loading documents from original origin after setting document.domain") // try to load a document from the origin document.domain was set to test(function () { var client = new XMLHttpRequest() - client.open("GET", location.protocol + '//' + document.domain + location.pathname.replace(/[^\/]*$/, '') + "resources/status.php?content=hello3", false) + client.open("GET", location.protocol + '//' + document.domain + location.pathname.replace(/[^\/]*$/, '') + "resources/status.py?content=hello3", false) // AFAIK this should throw assert_throws('NetworkError', function(){client.send(null)}) }, "loading documents from the origin document.domain was set to should throw") diff --git a/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm b/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm index 3ab6326..33bea68 100644 --- a/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm +++ b/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head> @@ -14,9 +15,9 @@ var client = new XMLHttpRequest(), urlstart = 'www1.'+location.host + location.pathname.replace(/\/[^\/]*$/, '/') client.withCredentials = true - client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.php", false, 'user', 'pass') - client.setRequestHeader("x-user", 'user') - client.setRequestHeader("x-pass", 'pass') + user = token() + client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass') + client.setRequestHeader("x-user", user) assert_throws("NetworkError", function(){ client.send(null) }) assert_equals(client.responseText, '') assert_equals(client.status, 0) diff --git a/XMLHttpRequest/send-authentication-basic-cors.htm b/XMLHttpRequest/send-authentication-basic-cors.htm index 165e603..d0f72b7 100644 --- a/XMLHttpRequest/send-authentication-basic-cors.htm +++ b/XMLHttpRequest/send-authentication-basic-cors.htm
@@ -15,7 +15,7 @@ var client = new XMLHttpRequest(), urlstart = 'www1.'+location.host + location.pathname.replace(/\/[^\/]*$/, '/') client.withCredentials = true - client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/corsenabled.php", true, 'user', 'pass') + client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/corsenabled.py", true, 'user', 'pass') client.setRequestHeader("x-user", 'user') client.setRequestHeader("x-pass", 'pass') client.onreadystatechange = function(){ @@ -24,7 +24,7 @@ assert_equals(client.responseText, '') assert_equals(client.status, 0) assert_equals(client.getResponseHeader('x-challenge'), null) - test.done() + test.done() }) } } diff --git a/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm b/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm index a4f8fff..c588693 100644 --- a/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm +++ b/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head> @@ -12,17 +13,18 @@ <script> test(function() { var client = new XMLHttpRequest(), - urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.php", false, 'user', 'pass') - client.setRequestHeader("x-user", 'user') - client.setRequestHeader("x-pass", 'pass') + urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'), + user = token() + client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass') + client.setRequestHeader("x-user", user) client.send(null) // Repeat request but *without* credentials in the open() call. // Is the UA supposed to cache credentials from above request and use them? Yes. - client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.php", false) + client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false) + client.setRequestHeader("x-user", user) client.send(null) - assert_equals(client.responseText, 'user' + "\n" + 'pass') + assert_equals(client.responseText, user + "\n" + 'pass') //assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') }, document.title) diff --git a/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm b/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm index 414573e..00ce845 100644 --- a/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm +++ b/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader() when there is an existing session</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. --> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> @@ -15,34 +16,36 @@ test.step(function() { var client = new XMLHttpRequest(), urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - // Initial request: no information is known to the UA about whether resources/auth4/auth.php requires authentication, + // Initial request: no information is known to the UA about whether resources/auth4/auth.py requires authentication, // hence it first sends a normal request, gets a 401 response that will not be passed on to the JS, and sends a new // request with an Authorization header before returning // (Note: this test will only work as expected if run once per browsing session) - client.open("GET", location.protocol+'//'+urlstart + "resources/auth4/auth.php", false, 'open-user', 'open-pass') + var open_user = token() + client.open("GET", location.protocol+'//'+urlstart + "resources/auth4/auth.py", false, open_user, 'open-pass') + client.setRequestHeader('X-User', open_user) // initial request - this will get a 401 response and re-try with HTTP auth client.send(null) - assert_equals(client.responseText, 'open-user\nopen-pass') + assert_equals(client.responseText, open_user + '\nopen-pass') assert_equals(client.status, 200) assert_equals(client.getResponseHeader('x-challenge'), 'DID') // Another request, this time user,pass is omitted and an Authorization header set explicitly // Here the URL is known to require authentication (from the request above), and the UA has cached open-user:open-pass credentials // However, these session credentials should now be overridden by the setRequestHeader() call so the UA should immediately // send basic Authorization header with credentials user:pass. (This part is perhaps not well specified anywhere) - client.open("GET", location.protocol+'//'+urlstart + "resources/auth4/auth.php", true) - client.setRequestHeader("x-user", 'user') - client.setRequestHeader("x-pass", 'pass') - client.setRequestHeader('Authorization', 'Basic dXNlcjpwYXNz') + var user = token(); + client.open("GET", location.protocol+'//'+urlstart + "resources/auth4/auth.py", true) + client.setRequestHeader("x-user", user) + client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass")) client.onreadystatechange = function () { if (client.readyState < 4) {return} test.step( function () { - assert_equals(client.responseText, 'user\npass') + assert_equals(client.responseText, user + '\npass') assert_equals(client.status, 200) assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') test.done() } ) } - client.send(null) + client.send(null) }) </script> <p>Note: this test will only work as expected once per browsing session. Restart browser to re-test.</p> diff --git a/XMLHttpRequest/send-authentication-basic-setrequestheader.htm b/XMLHttpRequest/send-authentication-basic-setrequestheader.htm index 9b70702..76c3687 100644 --- a/XMLHttpRequest/send-authentication-basic-setrequestheader.htm +++ b/XMLHttpRequest/send-authentication-basic-setrequestheader.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader()</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. --> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> @@ -14,21 +15,21 @@ var test = async_test() test.step(function() { var client = new XMLHttpRequest(), - urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth2/auth.php", false) - client.setRequestHeader("x-user", 'user') - client.setRequestHeader("x-pass", 'pass') - client.setRequestHeader('Authorization', 'Basic dXNlcjpwYXNz') + urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'), + user = token() + client.open("GET", location.protocol+'//'+urlstart + "resources/auth2/auth.py", false) + client.setRequestHeader("x-user", user) + client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass")) client.onreadystatechange = function () { if (client.readyState < 4) {return} test.step( function () { - assert_equals(client.responseText, 'user\npass') + assert_equals(client.responseText, user + '\npass') assert_equals(client.status, 200) assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') test.done() } ) } - client.send(null) + client.send(null) }) </script> </body> diff --git a/XMLHttpRequest/send-authentication-basic.htm b/XMLHttpRequest/send-authentication-basic.htm index 3fae1f0..2f0b345 100644 --- a/XMLHttpRequest/send-authentication-basic.htm +++ b/XMLHttpRequest/send-authentication-basic.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open()</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head> @@ -12,12 +13,12 @@ <script> test(function() { var client = new XMLHttpRequest(), - urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.php", false, 'user', 'pass') - client.setRequestHeader("x-user", 'user') - client.setRequestHeader("x-pass", 'pass') + urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'), + user = token(); + client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass') + client.setRequestHeader("x-user", user) client.send(null) - assert_equals(client.responseText, 'user' + "\n" + 'pass') + assert_equals(client.responseText, user + "\n" + 'pass') assert_equals(client.getResponseHeader('x-challenge'), 'DID') }, document.title) </script> diff --git a/XMLHttpRequest/send-authentication-competing-names-passwords.htm b/XMLHttpRequest/send-authentication-competing-names-passwords.htm index a310a92..cf80278 100644 --- a/XMLHttpRequest/send-authentication-competing-names-passwords.htm +++ b/XMLHttpRequest/send-authentication-competing-names-passwords.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head> <body> @@ -30,26 +31,24 @@ urlstart += ":" + pass1 urlstart += "@" + location.host + location.pathname.replace(/\/[^\/]*$/, '/') } - client.open("GET", urlstart + "resources/authentication.php", false, user2, pass2) + client.open("GET", urlstart + "resources/authentication.py", false, user2, pass2) client.setRequestHeader("x-user", userwin) - client.setRequestHeader("x-pass", passwin) client.send(null) assert_equals(client.responseText, (userwin||'') + "\n" + (passwin||'')) // We want to send multiple requests to the same realm here, so we try to make the UA forget its (cached) credentials between each test.. // forcing a 401 response to (hopefully) "log out" // NOTE: This is commented out because it causes authentication prompts while running the test - //client.open('GET', "resources/authentication.php?logout=1", false) + //client.open('GET', "resources/authentication.py?logout=1", false) //client.send() }, document.title+' '+name) } - var ident = Math.random() - request(null, null, ident+1, ident+2, 'user/pass in open() call') - request(null, null, ident+3, ident+4, 'another user/pass in open() call - must override cached credentials from previous test') - request("userinfo-user", "userinfo-pass", ident+5, ident+6, 'user/pass both in URL userinfo AND open() call - expexted that open() wins') - request(ident+7, ident+8, null, null, 'user/pass *only* in URL userinfo') - request(ident+9, null, null, ident+10, 'user name in URL userinfo, password in open() call: user name wins and password is thrown away') - request("1", ident+11, ident+12, null, 'user name and password in URL userinfo, only user name in open() call: user name in open() wins') + request(null, null, token(), token(), 'user/pass in open() call') + request(null, null, token(), token(), 'another user/pass in open() call - must override cached credentials from previous test') + request("userinfo-user", "userinfo-pass", token(), token(), 'user/pass both in URL userinfo AND open() call - expexted that open() wins') + request(token(), token(), null, null, 'user/pass *only* in URL userinfo') + request(token(), null, null, token(), 'user name in URL userinfo, password in open() call: user name wins and password is thrown away') + request("1", token(), token(), null, 'user name and password in URL userinfo, only user name in open() call: user name in open() wins') </script> </body> </html> diff --git a/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm b/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm index 6a94feb..8a87742 100644 --- a/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm +++ b/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm
@@ -4,6 +4,7 @@ <title>XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() (expects to succeed)</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. --> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> @@ -14,22 +15,23 @@ var test = async_test() test.step(function() { var client = new XMLHttpRequest(), - urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//www1.'+urlstart + "resources/auth2/corsenabled.php", false) + urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'), + user = token() + client.open("GET", location.protocol+'//www1.'+urlstart + "resources/auth2/corsenabled.py", false) client.withCredentials = true - client.setRequestHeader("x-user", 'user') + client.setRequestHeader("x-user", user) client.setRequestHeader("x-pass", 'pass') - client.setRequestHeader('Authorization', 'Basic dXNlcjpwYXNz') + client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass")) client.onreadystatechange = function () { if (client.readyState < 4) {return} test.step( function () { - assert_equals(client.responseText, 'user\npass') + assert_equals(client.responseText, user + '\npass') assert_equals(client.status, 200) assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') test.done() } ) } - client.send(null) + client.send(null) }) </script> </body> diff --git a/XMLHttpRequest/send-authentication-existing-session-interactive.htm b/XMLHttpRequest/send-authentication-existing-session-manual.htm similarity index 60% rename from XMLHttpRequest/send-authentication-existing-session-interactive.htm rename to XMLHttpRequest/send-authentication-existing-session-manual.htm index d6e56ef..fa19ee1 100644 --- a/XMLHttpRequest/send-authentication-existing-session-interactive.htm +++ b/XMLHttpRequest/send-authentication-existing-session-manual.htm
@@ -4,24 +4,27 @@ <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password from interactive session</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head> <body> <p>Please follow these steps to complete the test:</p> + <script>var user = token();</script> <ol> - <li>Load <a href="resources/auth3/auth.php">page</a> and authenticate with "user" and "pass"</li> + <li>Load <a href="resources/auth3/auth.py">page</a> and authenticate with username "<script>document.write(user)</script>" and password "pass"</li> <li>Go back</li> - <li>Click <a href="?dotest">complete test</a></li> + <li>Click <button onclick="location.href = location.href + '?dotest&user=' + user">complete test</button></li> </ol> <div id="log"></div> <script> - if(location.search === '?dotest'){ + if (location.search.indexOf('?dotest') != -1) { test(function() { - var client = new XMLHttpRequest(), + var user = location.search.slice(location.search.indexOf('&user=') + 6), + client = new XMLHttpRequest(), urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth3/auth.php", false) + client.open("GET", location.protocol+'//'+urlstart + "resources/auth3/auth.py", false) client.send(null) - assert_equals(client.responseText, 'user' + "\n" + 'pass') + assert_equals(client.responseText, user + "\n" + 'pass') assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') }, document.title) } diff --git a/XMLHttpRequest/send-authentication-prompt-interactive-2.htm b/XMLHttpRequest/send-authentication-prompt-2-manual.htm similarity index 96% rename from XMLHttpRequest/send-authentication-prompt-interactive-2.htm rename to XMLHttpRequest/send-authentication-prompt-2-manual.htm index dc68990..2da2c02 100644 --- a/XMLHttpRequest/send-authentication-prompt-interactive-2.htm +++ b/XMLHttpRequest/send-authentication-prompt-2-manual.htm
@@ -16,7 +16,7 @@ test(function() { var client = new XMLHttpRequest(), urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth6/auth.php", false) + client.open("GET", location.protocol+'//'+urlstart + "resources/auth6/auth.py", false) client.send(null) assert_equals(client.responseText, 'usr' + "\n" + 'secret') }, document.title) diff --git a/XMLHttpRequest/send-authentication-prompt-interactive.htm b/XMLHttpRequest/send-authentication-prompt-manual.htm similarity index 94% rename from XMLHttpRequest/send-authentication-prompt-interactive.htm rename to XMLHttpRequest/send-authentication-prompt-manual.htm index 3dea7ef..ce2d14e 100644 --- a/XMLHttpRequest/send-authentication-prompt-interactive.htm +++ b/XMLHttpRequest/send-authentication-prompt-manual.htm
@@ -16,7 +16,7 @@ test(function() { var client = new XMLHttpRequest(), urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') - client.open("GET", location.protocol+'//'+urlstart + "resources/auth5/auth.php", false, 'usr', 'wrongpassword') + client.open("GET", location.protocol+'//'+urlstart + "resources/auth5/auth.py", false, 'usr', 'wrongpassword') client.send(null) assert_equals(client.responseText, 'usr' + "\n" + 'secret') }, document.title) diff --git a/XMLHttpRequest/send-conditional.htm b/XMLHttpRequest/send-conditional.htm index 6e57468..1d9099b 100644 --- a/XMLHttpRequest/send-conditional.htm +++ b/XMLHttpRequest/send-conditional.htm
@@ -13,7 +13,7 @@ test(function() { var client = new XMLHttpRequest, identifier = type == "tag" ? Math.random() : new Date().toGMTString(), - url = "resources/conditional.php?" + type + "=" + identifier + url = "resources/conditional.py?" + type + "=" + identifier client.open("GET", url, false) client.send(null) assert_equals(client.status, 200) diff --git a/XMLHttpRequest/send-content-type-charset.htm b/XMLHttpRequest/send-content-type-charset.htm index 3b7426c..907fe40 100644 --- a/XMLHttpRequest/send-content-type-charset.htm +++ b/XMLHttpRequest/send-content-type-charset.htm
@@ -13,7 +13,7 @@ function request(input, output) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) if(input) client.setRequestHeader("Content-Type", input) client.send("TEST") diff --git a/XMLHttpRequest/send-content-type-string.htm b/XMLHttpRequest/send-content-type-string.htm index 33cc341..8e2a035 100644 --- a/XMLHttpRequest/send-content-type-string.htm +++ b/XMLHttpRequest/send-content-type-string.htm
@@ -12,7 +12,7 @@ function request(data, expected_type) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) client.send(data) assert_equals(client.getResponseHeader("x-request-content-type"), expected_type) }) diff --git a/XMLHttpRequest/send-data-arraybuffer.htm b/XMLHttpRequest/send-data-arraybuffer.htm index 965f63d..deadbc0 100644 --- a/XMLHttpRequest/send-data-arraybuffer.htm +++ b/XMLHttpRequest/send-data-arraybuffer.htm
@@ -39,9 +39,9 @@ } }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send(buf); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-data-blob.htm b/XMLHttpRequest/send-data-blob.htm index 778716d..7739f38 100644 --- a/XMLHttpRequest/send-data-blob.htm +++ b/XMLHttpRequest/send-data-blob.htm
@@ -33,7 +33,7 @@ blob = xhr.response; assert_true(blob instanceof Blob, "Blob from XHR Response"); - xhr2.open("POST", "./resources/content.php", true); + xhr2.open("POST", "./resources/content.py", true); xhr2.send(blob); }); } @@ -52,10 +52,10 @@ } }; - xhr.open("GET", "./resources/content.php?content=" + content, true); + xhr.open("GET", "./resources/content.py?content=" + content, true); xhr.responseType = "blob"; xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-data-formdata.htm b/XMLHttpRequest/send-data-formdata.htm index 941fb7a..19832eb 100644 --- a/XMLHttpRequest/send-data-formdata.htm +++ b/XMLHttpRequest/send-data-formdata.htm
@@ -34,9 +34,9 @@ }); }; - xhr.open("POST", "./resources/form.php", true); + xhr.open("POST", "./resources/form.py", true); xhr.send(form); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-entity-body-basic.htm b/XMLHttpRequest/send-entity-body-basic.htm index 67c1751..8e54496 100644 --- a/XMLHttpRequest/send-entity-body-basic.htm +++ b/XMLHttpRequest/send-entity-body-basic.htm
@@ -13,7 +13,7 @@ function request(input, output) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) client.send(input) assert_equals(client.responseText, output) }, document.title + " (" + output + ")") diff --git a/XMLHttpRequest/send-entity-body-document-bogus.htm b/XMLHttpRequest/send-entity-body-document-bogus.htm index e2833a0..bc5c232 100644 --- a/XMLHttpRequest/send-entity-body-document-bogus.htm +++ b/XMLHttpRequest/send-entity-body-document-bogus.htm
@@ -12,7 +12,7 @@ function request_throws(input) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) assert_throws("InvalidStateError", function() { client.send(input) }) }) } diff --git a/XMLHttpRequest/send-entity-body-document.htm b/XMLHttpRequest/send-entity-body-document.htm index c3b88c9..ca22bd0 100644 --- a/XMLHttpRequest/send-entity-body-document.htm +++ b/XMLHttpRequest/send-entity-body-document.htm
@@ -13,7 +13,7 @@ function request(input, isHTML) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) client.send(input) if(isHTML) assert_equals(client.responseText, "<html><head><\/head><body>\uFFFD<\/body><\/html>") diff --git a/XMLHttpRequest/send-entity-body-empty.htm b/XMLHttpRequest/send-entity-body-empty.htm index 40e710d..de21180 100644 --- a/XMLHttpRequest/send-entity-body-empty.htm +++ b/XMLHttpRequest/send-entity-body-empty.htm
@@ -12,7 +12,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) client.upload.onloadstart = function(){assert_unreached('this event should not fire for empty strings')} client.send("") assert_equals(client.getResponseHeader("x-request-content-length"), "0") diff --git a/XMLHttpRequest/send-entity-body-get-head-async.htm b/XMLHttpRequest/send-entity-body-get-head-async.htm index 0bfe551..18e7a94 100644 --- a/XMLHttpRequest/send-entity-body-get-head-async.htm +++ b/XMLHttpRequest/send-entity-body-get-head-async.htm
@@ -17,7 +17,7 @@ events.push(e.type) } var client = new XMLHttpRequest() - client.open(method, "resources/content.php") + client.open(method, "resources/content.py") client.upload.addEventListener('progress', logEvt) client.upload.addEventListener('loadend', logEvt) client.upload.addEventListener('loadstart', logEvt) diff --git a/XMLHttpRequest/send-entity-body-get-head.htm b/XMLHttpRequest/send-entity-body-get-head.htm index 4f9f74c..2f8a1b4 100644 --- a/XMLHttpRequest/send-entity-body-get-head.htm +++ b/XMLHttpRequest/send-entity-body-get-head.htm
@@ -17,7 +17,7 @@ events.push(e.type) } var client = new XMLHttpRequest() - client.open(method, "resources/content.php", false) + client.open(method, "resources/content.py", false) client.send("TEST") client.upload.addEventListener('progress', logEvt) client.upload.addEventListener('loadend', logEvt) diff --git a/XMLHttpRequest/send-entity-body-none.htm b/XMLHttpRequest/send-entity-body-none.htm index 322caec..9fbc267 100644 --- a/XMLHttpRequest/send-entity-body-none.htm +++ b/XMLHttpRequest/send-entity-body-none.htm
@@ -11,7 +11,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/content.php", false) + client.open("POST", "resources/content.py", false) client.upload.onloadstart = function(){assert_unreached('this event should not fire for null')} client.send(null) assert_equals(client.getResponseHeader("x-request-content-length"), "0") diff --git a/XMLHttpRequest/send-no-response-event-loadend.htm b/XMLHttpRequest/send-no-response-event-loadend.htm index bf89020..a9ffef9 100644 --- a/XMLHttpRequest/send-no-response-event-loadend.htm +++ b/XMLHttpRequest/send-no-response-event-loadend.htm
@@ -39,9 +39,9 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-no-response-event-loadstart.htm b/XMLHttpRequest/send-no-response-event-loadstart.htm index 562a4cb..71574f3 100644 --- a/XMLHttpRequest/send-no-response-event-loadstart.htm +++ b/XMLHttpRequest/send-no-response-event-loadstart.htm
@@ -39,9 +39,9 @@ test.step(function() { test.done("Test done!"); }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-no-response-event-order.htm b/XMLHttpRequest/send-no-response-event-order.htm index 14af1d0..289bffe 100644 --- a/XMLHttpRequest/send-no-response-event-order.htm +++ b/XMLHttpRequest/send-no-response-event-order.htm
@@ -57,9 +57,9 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send(); }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-redirect-bogus-sync.htm b/XMLHttpRequest/send-redirect-bogus-sync.htm index dfadca3..011fd92 100644 --- a/XMLHttpRequest/send-redirect-bogus-sync.htm +++ b/XMLHttpRequest/send-redirect-bogus-sync.htm
@@ -12,7 +12,7 @@ function redirect(code, location) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/redirect.php?location=" + location + "&code=" + code, false) + client.open("GET", "resources/redirect.py?location=" + location + "&code=" + code, false) assert_throws("NetworkError", function() { client.send(null) }) }, document.title + " (" + code + ": " + location + ")") } diff --git a/XMLHttpRequest/send-redirect-bogus.htm b/XMLHttpRequest/send-redirect-bogus.htm index 89feb1a..218508d 100644 --- a/XMLHttpRequest/send-redirect-bogus.htm +++ b/XMLHttpRequest/send-redirect-bogus.htm
@@ -23,7 +23,7 @@ } }) } - client.open("GET", "resources/redirect.php?location=" + location + "&code=" + code) + client.open("GET", "resources/redirect.py?location=" + location + "&code=" + code) client.send(null) }) } diff --git a/XMLHttpRequest/send-redirect-infinite-sync.htm b/XMLHttpRequest/send-redirect-infinite-sync.htm index a24477d..ec98412 100644 --- a/XMLHttpRequest/send-redirect-infinite-sync.htm +++ b/XMLHttpRequest/send-redirect-infinite-sync.htm
@@ -14,7 +14,7 @@ function redirect(code) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/infinite-redirects.php?type="+code, false) + client.open("GET", "resources/infinite-redirects.py?type="+code, false) assert_throws("NetworkError", function() { client.send(null) }) }, document.title + " (" + code + ")") } diff --git a/XMLHttpRequest/send-redirect-infinite.htm b/XMLHttpRequest/send-redirect-infinite.htm index f661965..33c3465 100644 --- a/XMLHttpRequest/send-redirect-infinite.htm +++ b/XMLHttpRequest/send-redirect-infinite.htm
@@ -17,7 +17,7 @@ var client = new XMLHttpRequest(), errorEventFired = false, code = 301 - client.open("GET", "resources/infinite-redirects.php?type="+code) + client.open("GET", "resources/infinite-redirects.py?type="+code) client.onerror = function(){ errorEventFired = true } diff --git a/XMLHttpRequest/send-redirect-no-location.htm b/XMLHttpRequest/send-redirect-no-location.htm index ffa358e..cd8fa9c 100644 --- a/XMLHttpRequest/send-redirect-no-location.htm +++ b/XMLHttpRequest/send-redirect-no-location.htm
@@ -27,7 +27,7 @@ } }) } - client.open("GET", "resources/status.php?content=<x>x<\/x>&type=text/xml&text=ABE ODDYSSEE&code=" + code) + client.open("GET", "resources/status.py?content=<x>x<\/x>&type=text/xml&text=ABE ODDYSSEE&code=" + code) client.send(null) }) } diff --git a/XMLHttpRequest/send-redirect-to-cors.htm b/XMLHttpRequest/send-redirect-to-cors.htm index 7301808..4cf79d9 100644 --- a/XMLHttpRequest/send-redirect-to-cors.htm +++ b/XMLHttpRequest/send-redirect-to-cors.htm
@@ -22,7 +22,7 @@ } }) } - client.open("GET", "resources/redirect.php?location="+encodeURIComponent("http://www2."+location.hostname+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.php')+"&code=" + code) + client.open("GET", "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+"&code=" + code) client.setRequestHeader("Content-Type", "application/x-pony") client.send(null) }) diff --git a/XMLHttpRequest/send-redirect-to-non-cors.htm b/XMLHttpRequest/send-redirect-to-non-cors.htm index 7ad3aa4..df434ff 100644 --- a/XMLHttpRequest/send-redirect-to-non-cors.htm +++ b/XMLHttpRequest/send-redirect-to-non-cors.htm
@@ -23,7 +23,7 @@ } }) } - client.open("GET", "resources/redirect.php?location="+encodeURIComponent("http://www2."+location.hostname+(location.pathname.replace(/[^\/]+$/, ''))+'resources/content.php')+"&code=" + code) + client.open("GET", "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.hostname+(location.pathname.replace(/[^\/]+$/, ''))+'resources/content.py')+"&code=" + code) client.setRequestHeader("Content-Type", "application/x-pony") client.send(null) }) diff --git a/XMLHttpRequest/send-redirect.htm b/XMLHttpRequest/send-redirect.htm index 65b568c..58b4588 100644 --- a/XMLHttpRequest/send-redirect.htm +++ b/XMLHttpRequest/send-redirect.htm
@@ -22,7 +22,7 @@ } }) } - client.open("GET", "resources/redirect.php?location=content.php&code=" + code) + client.open("GET", "resources/redirect.py?location=content.py&code=" + code) client.setRequestHeader("Content-Type", "application/x-pony") client.send(null) }) diff --git a/XMLHttpRequest/send-response-event-order.htm b/XMLHttpRequest/send-response-event-order.htm index d47f914..8062548 100644 --- a/XMLHttpRequest/send-response-event-order.htm +++ b/XMLHttpRequest/send-response-event-order.htm
@@ -41,7 +41,7 @@ xhr.onload = function(e){ actual.push(e.type); }; xhr.onloadend = function(e){ actual.push(e.type); VerifyResult()}; xhr.onprogress = function(e){ actual.push(e.type);}; - + xhr.upload.onloadstart = function(e){ actual.push("upload." + e.type); }; xhr.upload.onload = function(e){ actual.push("upload." + e.type); }; xhr.upload.onloadend = function(e){ actual.push("upload." + e.type);}; @@ -56,7 +56,7 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> diff --git a/XMLHttpRequest/send-response-upload-event-loadend.htm b/XMLHttpRequest/send-response-upload-event-loadend.htm index d28c265..c73be73 100644 --- a/XMLHttpRequest/send-response-upload-event-loadend.htm +++ b/XMLHttpRequest/send-response-upload-event-loadend.htm
@@ -31,7 +31,7 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> diff --git a/XMLHttpRequest/send-response-upload-event-loadstart.htm b/XMLHttpRequest/send-response-upload-event-loadstart.htm index 5750d18..b2da2b2 100644 --- a/XMLHttpRequest/send-response-upload-event-loadstart.htm +++ b/XMLHttpRequest/send-response-upload-event-loadstart.htm
@@ -30,7 +30,7 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> diff --git a/XMLHttpRequest/send-response-upload-event-progress.htm b/XMLHttpRequest/send-response-upload-event-progress.htm index 8b4e749..acda543 100644 --- a/XMLHttpRequest/send-response-upload-event-progress.htm +++ b/XMLHttpRequest/send-response-upload-event-progress.htm
@@ -30,7 +30,7 @@ }); }; - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/content.py", true); xhr.send("Test Message"); }); </script> diff --git a/XMLHttpRequest/send-sync-no-response-event-load.htm b/XMLHttpRequest/send-sync-no-response-event-load.htm index a57e9b1..e74af5c 100644 --- a/XMLHttpRequest/send-sync-no-response-event-load.htm +++ b/XMLHttpRequest/send-sync-no-response-event-load.htm
@@ -26,7 +26,7 @@ pass = true; }; - xhr.open("POST", "./resources/content.php", false); + xhr.open("POST", "./resources/content.py", false); xhr.send(); assert_equals(xhr.response, ""); @@ -34,4 +34,4 @@ }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-sync-no-response-event-loadend.htm b/XMLHttpRequest/send-sync-no-response-event-loadend.htm index 4738a6a..3b26bd0 100644 --- a/XMLHttpRequest/send-sync-no-response-event-loadend.htm +++ b/XMLHttpRequest/send-sync-no-response-event-loadend.htm
@@ -26,7 +26,7 @@ pass = true; }; - xhr.open("POST", "./resources/content.php", false); + xhr.open("POST", "./resources/content.py", false); xhr.send(); assert_equals(xhr.response, ""); @@ -34,4 +34,4 @@ }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-sync-no-response-event-order.htm b/XMLHttpRequest/send-sync-no-response-event-order.htm index 6f50cab..e692a85 100644 --- a/XMLHttpRequest/send-sync-no-response-event-order.htm +++ b/XMLHttpRequest/send-sync-no-response-event-order.htm
@@ -39,7 +39,7 @@ xhr.upload.onloadstart = function(e){ actual.push("upload." + e.type); }; xhr.upload.onloadend = function(e){ actual.push("upload." + e.type);}; - xhr.open("POST", "./resources/content.php", false); + xhr.open("POST", "./resources/content.py", false); xhr.send(); assert_equals(xhr.response, ""); @@ -47,4 +47,4 @@ }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-sync-response-event-order.htm b/XMLHttpRequest/send-sync-response-event-order.htm index 9021f0e..7ad29d2 100644 --- a/XMLHttpRequest/send-sync-response-event-order.htm +++ b/XMLHttpRequest/send-sync-response-event-order.htm
@@ -39,7 +39,7 @@ xhr.upload.onloadstart = function(e){ actual.push("upload." + e.type); }; xhr.upload.onloadend = function(e){ actual.push("upload." + e.type);}; - xhr.open("POST", "./resources/content.php", false); + xhr.open("POST", "./resources/content.py", false); xhr.send("Test Message"); assert_equals(xhr.response, "Test Message"); @@ -47,4 +47,4 @@ }); </script> </body> -</html> \ No newline at end of file +</html> diff --git a/XMLHttpRequest/send-timeout-events.htm b/XMLHttpRequest/send-timeout-events.htm index 564894e..fc7ec85 100644 --- a/XMLHttpRequest/send-timeout-events.htm +++ b/XMLHttpRequest/send-timeout-events.htm
@@ -53,7 +53,7 @@ content += "[" + i + "]"; } - xhr.open("POST", "./resources/trickle.php", true); + xhr.open("POST", "./resources/trickle.py", true); xhr.timeout = 1; xhr.send(content); }); diff --git a/XMLHttpRequest/setrequestheader-after-send.htm b/XMLHttpRequest/setrequestheader-after-send.htm index 84db388..5ddd424 100644 --- a/XMLHttpRequest/setrequestheader-after-send.htm +++ b/XMLHttpRequest/setrequestheader-after-send.htm
@@ -12,7 +12,7 @@ var test = async_test() test.step(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/delay.php?ms=0") + client.open("GET", "resources/delay.py?ms=0") client.onreadystatechange = function() { test.step(function() { assert_throws("InvalidStateError", function() { client.setRequestHeader("x-test", "test") }) diff --git a/XMLHttpRequest/setrequestheader-case-insensitive.htm b/XMLHttpRequest/setrequestheader-case-insensitive.htm index 8d7487e..7eb81d1 100644 --- a/XMLHttpRequest/setrequestheader-case-insensitive.htm +++ b/XMLHttpRequest/setrequestheader-case-insensitive.htm
@@ -11,7 +11,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/inspect-headers.php?filter_value=t1, t2, t3", false) + client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2, t3", false) client.setRequestHeader("x-test", "t1") client.setRequestHeader("X-TEST", "t2") client.setRequestHeader("X-teST", "t3") diff --git a/XMLHttpRequest/setrequestheader-header-allowed.htm b/XMLHttpRequest/setrequestheader-header-allowed.htm index f2abc5c..7d187c5 100644 --- a/XMLHttpRequest/setrequestheader-header-allowed.htm +++ b/XMLHttpRequest/setrequestheader-header-allowed.htm
@@ -12,7 +12,7 @@ function request(header) { test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/inspect-headers.php?filter_value=t1, t2", false) + client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2", false) client.setRequestHeader(header, "t1") client.setRequestHeader(header, "t2") client.send(null) diff --git a/XMLHttpRequest/setrequestheader-header-forbidden.htm b/XMLHttpRequest/setrequestheader-header-forbidden.htm index 0fc5a39..222b28f 100644 --- a/XMLHttpRequest/setrequestheader-header-forbidden.htm +++ b/XMLHttpRequest/setrequestheader-header-forbidden.htm
@@ -12,7 +12,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("POST", "resources/inspect-headers.php?filter_value=TEST", false) + client.open("POST", "resources/inspect-headers.py?filter_value=TEST", false) client.setRequestHeader("Accept-Charset", "TEST") client.setRequestHeader("Accept-Encoding", "TEST") client.setRequestHeader("Connection", "TEST") diff --git a/XMLHttpRequest/status-async.htm b/XMLHttpRequest/status-async.htm index 66274b1..a0fc2b8 100644 --- a/XMLHttpRequest/status-async.htm +++ b/XMLHttpRequest/status-async.htm
@@ -39,7 +39,7 @@ } }, this) } - client.open(method, "resources/status.php?code=" + encodeURIComponent(code) + "&text=" + text + "&content=" + encodeURIComponent(content) + "&type=" + encodeURIComponent(type)) + client.open(method, "resources/status.py?code=" + encodeURIComponent(code) + "&text=" + text + "&content=" + encodeURIComponent(content) + "&type=" + encodeURIComponent(type)) client.send(null) }) }
diff --git a/XMLHttpRequest/status-basic.htm b/XMLHttpRequest/status-basic.htm index 2d4f0dd..a496035 100644 --- a/XMLHttpRequest/status-basic.htm +++ b/XMLHttpRequest/status-basic.htm
@@ -17,7 +17,7 @@ counter++ test(function() { var client = new XMLHttpRequest() - client.open(method, "resources/status.php?code=" + code + "&text=" + encodeURIComponent(text) + "&content=" + encodeURIComponent(content) + "&type=" + encodeURIComponent(type), false) + client.open(method, "resources/status.py?code=" + code + "&text=" + encodeURIComponent(text) + "&content=" + encodeURIComponent(content) + "&type=" + encodeURIComponent(type), false) client.send(null) assert_equals(client.status, code) assert_equals(client.statusText, text) diff --git a/XMLHttpRequest/status-error.htm b/XMLHttpRequest/status-error.htm index 5e9eba8..c584b19 100644 --- a/XMLHttpRequest/status-error.htm +++ b/XMLHttpRequest/status-error.htm
@@ -16,7 +16,7 @@ test.step(function() { var client = new XMLHttpRequest() - client.open(method, "resources/status.php?code=" + code, true) + client.open(method, "resources/status.py?code=" + code, true) client.onreadystatechange = test.step_func(function() { assert_equals(client.response, "", "response data") diff --git a/XMLHttpRequest/tests/submissions/Opera/resources/upload.php b/XMLHttpRequest/tests/submissions/Opera/resources/upload.php deleted file mode 100644 index 978fa0e..0000000 --- a/XMLHttpRequest/tests/submissions/Opera/resources/upload.php +++ /dev/null
@@ -1,12 +0,0 @@ -<?php -ksort($_POST); -ksort($_FILES); -if (!empty($_POST)) - foreach ($_POST as $k => $v) - echo "{$k}={$v},"; -echo "\n"; -if (!empty($_FILES)) - foreach ($_FILES as $k => $v) - echo "{$k}={$v['name']}:{$v['type']}:{$v['size']},"; - -?> diff --git a/XMLHttpRequest/timeout-cors-async.htm b/XMLHttpRequest/timeout-cors-async.htm index ca5a7e5..cc980fe 100644 --- a/XMLHttpRequest/timeout-cors-async.htm +++ b/XMLHttpRequest/timeout-cors-async.htm
@@ -15,20 +15,20 @@ <script> var test = async_test(document.title) var client = new XMLHttpRequest() - client.open("GET", "http://www2."+location.hostname+(location.pathname.replace(/[^\/]+$/, '')+'resources/corsenabled.php')+"?delay=2&code=200") + client.open("GET", "http://www2." + location.hostname + (location.port ? ":" + location.port : "") +(location.pathname.replace(/[^\/]+$/, '')+'resources/corsenabled.py')+"?delay=2&code=200") client.timeout = 100 client.addEventListener('timeout', function (e) { test.step(function() { assert_equals(e.type, 'timeout') - assert_equals(client.status, 4) + assert_equals(client.status, 0) test.done() - }) + }) }) client.addEventListener('load', function (e) { test.step(function() { assert_unreached('load event should not fire') test.done() - }) + }) }) client.send(null) diff --git a/XMLHttpRequest/withcredentials-anonymous.htm b/XMLHttpRequest/withcredentials-anonymous.htm index 88c5f79..1da6de2 100644 --- a/XMLHttpRequest/withcredentials-anonymous.htm +++ b/XMLHttpRequest/withcredentials-anonymous.htm
@@ -12,20 +12,20 @@ <script> var client = new XMLHttpRequest({anonymous:true}) test(function() { - client.open("GET", "resources/delay.php?ms=1000") + client.open("GET", "resources/delay.py?ms=1000") assert_throws("InvalidStateError", function() { client.withCredentials=true }) }, "throw when set on anonymous request") var client = new XMLHttpRequest() test(function() { - client.open("GET", "resources/delay.php?ms=1000", false) + client.open("GET", "resources/delay.py?ms=1000", false) assert_throws("InvalidStateError", function() { client.withCredentials=true }) }, "throw when set on sync request") var client = new XMLHttpRequest() test(function() { client.withCredentials=true - assert_throws("InvalidStateError", function() { client.open("GET", "resources/delay.php?ms=1000", false) }) + assert_throws("InvalidStateError", function() { client.open("GET", "resources/delay.py?ms=1000", false) }) }, "throw when opening sync request after setting withCredentials to true") </script> diff --git a/XMLHttpRequest/withcredentials-set.htm b/XMLHttpRequest/withcredentials-set.htm index e025fe0..efd4ebc 100644 --- a/XMLHttpRequest/withcredentials-set.htm +++ b/XMLHttpRequest/withcredentials-set.htm
@@ -18,7 +18,7 @@ var client = new XMLHttpRequest() test(function() { - client.open("GET", "resources/delay.php?ms=1000", false) + client.open("GET", "resources/delay.py?ms=1000", false) client.withCredentials=true assert_true(client.withCredentials, "set in OPEN state") }, "can also be set in OPEN state") diff --git a/XMLHttpRequest/withcredentials-wrong-state.htm b/XMLHttpRequest/withcredentials-wrong-state.htm index 5da50a3..46b2ded 100644 --- a/XMLHttpRequest/withcredentials-wrong-state.htm +++ b/XMLHttpRequest/withcredentials-wrong-state.htm
@@ -12,7 +12,7 @@ var test = async_test(document.title) var client = new XMLHttpRequest() test.step(function() { - client.open("GET", "resources/delay.php?ms=1000") + client.open("GET", "resources/delay.py?ms=1000") client.send() assert_throws("InvalidStateError", function() { client.withCredentials=true }) client.onreadystatechange = function(){ diff --git a/XMLHttpRequest/xmlhttprequest-network-error-sync.htm b/XMLHttpRequest/xmlhttprequest-network-error-sync.htm index 0767d50..51da6cf 100644 --- a/XMLHttpRequest/xmlhttprequest-network-error-sync.htm +++ b/XMLHttpRequest/xmlhttprequest-network-error-sync.htm
@@ -19,7 +19,7 @@ <script> test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/infinite-redirects.php", false) + client.open("GET", "resources/infinite-redirects.py", false) assert_throws("NetworkError", function() { client.send(null) }, "send") assert_equals(client.status, 0, "status") assert_equals(client.statusText, "", "statusText") diff --git a/XMLHttpRequest/xmlhttprequest-network-error.htm b/XMLHttpRequest/xmlhttprequest-network-error.htm index 420d757..eb35367 100644 --- a/XMLHttpRequest/xmlhttprequest-network-error.htm +++ b/XMLHttpRequest/xmlhttprequest-network-error.htm
@@ -31,7 +31,7 @@ test.done() }) } - client.open("GET", "resources/infinite-redirects.php") + client.open("GET", "resources/infinite-redirects.py") client.send(null) }) </script>